Better EJB3 IOC
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 som开发者_高级运维e 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
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.
精彩评论