-
1. Re: How to inject EJBs with custom injector?
jaikiran Aug 23, 2010 4:54 AM (in response to christian.strempfer)Christian, welcome to the forums.
Christian Strempfer wrote:
Should trigger:
return ServiceLocator.findEJBService(TestService.class, "ejb/TestService")
My intention is to keep the deployment transparent for the developers. They can use @EJB as normal, but will end up using the service locator.Isn't it already transparent? I mean each developer just has to do @EJB. That's it! I'm not sure I understand the rationale behind using the ServiceLocator.
-
2. Re: How to inject EJBs with custom injector?
christian.strempfer Aug 23, 2010 5:37 AM (in response to jaikiran)There are EJBs distributed across different servers, which have their own Java Naming Directories. Because of that I cannot define exactly one JNDI-URL for the lookup. The service locator is configured, so that it can determine the lookup URL.
-
3. Re: How to inject EJBs with custom injector?
wdfink Sep 2, 2010 5:46 AM (in response to christian.strempfer)I do not understand why you will spread EJBs accross different server.
@EJB will be transparent.
A individual lookup will increase the complexity. Also you might have problems with transaction handling.
-
4. Re: How to inject EJBs with custom injector?
christian.strempfer Sep 2, 2010 8:52 AM (in response to wdfink)Thank you for your advice about transaction handling, but the deployment scenario is not up for discussion, it is a specified requirement. We have application components which may be deployed independently on different servers. Also there are components which need access to other components on more than one server.
-
5. Re: How to inject EJBs with custom injector?
wdfink Sep 2, 2010 10:00 AM (in response to christian.strempfer)No, this is special. If you want to decide which server you want to connect the only way IMHO is to code it.
One option is a @PostConstruct initializer will fill, another one can be a Interceptor and your own annotation.