wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Dependency Injection works only in managed classes. What does this mean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Dependency Injection works only in managed classes. What does this mean" Watch "Dependency Injection works only in managed classes. What does this mean" New topic
Author

Dependency Injection works only in managed classes. What does this mean

ramakrishna kulkarni
Greenhorn

Joined: Feb 06, 2009
Posts: 14
Hi All

Dependency Injection is not supported in non managed clasess in EJB and web teir.

My doubt here is what they mean my mangaged classes

Thanks in advance
Prasad Shindikar
Ranch Hand

Joined: Feb 18, 2007
Posts: 114
Managed classes mean, the classes that are managed by the container. These can be Servlets, EJBs, JSF Backing beans etc. However, these cannot be Helper Classes that can be custom defined to provide for some specific functionality.

Since DI happens courtesy of the container, helper classes cannot access DI.

Hope this helps.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dependency Injection works only in managed classes. What does this mean
 
Similar Threads
java.lang.RuntimeException: <injection-target> - error
Dependency Injection not working?
How to run EJB3 client
Spring Live
EJB injection doesn't work in JSF Convertor