views:

19

answers:

0

How can I inject EJBs with my own injector?

I have a distributed environment and a service locator, which can locate all EJBs. Is it possible to use the standard @EJB-Annotation, but make the lookup on my own?

For example:

@javax.ejb.EJB(name = "ejb/StackOverflow")
private StackOverflow stackOverflowService;

Should finally do:

return ServiceLocator.findEJBService(StackOverflow.class, "ejb/StackOverflow")

If this could only be solved vendor-specific, a solution for JBoss 5.1 would be fine.