javadependency-injectionejb-3.0guicejava-ee-5

Google Guice. Inject EJB when using Java EE5


It is possible to use Google Guice (any other DI framework) for injecting EJBs in Java EE 5? By default Java EE 5 uses JNDI to injecting EJBs.


Solution

  • I have no direct experience with Guice - but yes, it's possible to use other frameworks for injecting EJBs in a JEE5 application. For instance, Seam does just that. So in principle, it should be possible as there isn't an inherent restriction in the kind of objects that can be injected, as long as the framework takes care of all the lookup details.

    UPDATE:

    Take a look at this post detailing how to inject EJBs using Guice.