To me DI is a Service Locator pattern implemented by the Container!!
However until DI is made availbale in non-managed classes too, app developer will have to take the responsibility of implementing Service Locator pattern.
The only way to make your dream come true is to wake up.
Service Locator pattern is still need for web frameworks that does not support DI.
An alternative for such is simply let the EJB container inject instances of the session beans (whether remote or local) into a servlet which are declared as instance variables, override the init and load the servlet at startup. Now you have a service locator POJO (singleton that wraps a synchornized map) that already caches the instances of the session beans for the perusal of other classes.
Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
You may use Seam, Spring or Guice to inject resources from JNDI (including EJBs) into non-managed classes. Java EE 6 standardizes this via WebBeans. However, there are many people using Java EE 5 that just use look-ups for this case since it does not happen that often.
Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com