Reputation: 946
does anyone knows how to "plug in" or enable IOC for injecting @EJB in classes which are not EJBs or Servlets (but rather POJOs)? So, if EJB and Servlet use helper classes, their EJB annotations are not processed. Application server is Glassfish v2.1.
Is there a way to enable this with some lightweight framework?
Guice doesn't work with EJBs smoothly.
Spring is too bloated for my needs (existing large application).
Basically I'm trying to remove JNDI lookups from many helper classes.
Do you have any suggestions?
Thank you,
Bozo
Upvotes: 1
Views: 958
Reputation: 597076
Try adding a Local interfaces for those helper classes, and annotate them (the classes) with @Stateless. Thus they can be recognized as parts of the EJB context. Then inject them in your EJBs using the Local interfaces.
Upvotes: 2