Java EE 5 can handle injections transparently when used on container managed components. From the Java EE 5 spec, the following Java EE components support injection and the post/pre construct annotations:
Typically injection will occur after an instance of the class is constructed, but before any business methods are called. Method injection is also supported.
Injection is limited only to first class constructs defined in the Java EE platform, including:
The injection facilities in Java EE 5 do not apply to any POJO (which is often criticized by the Spring community) or two JSPs, Tag files, and certain JSF constructs:
SessionContext
objectDataSources
objectUserTransaction
EntityManager
interfaceTimerService
interface- Other enterprise beans
- Web services
- Message queues and topics
- Connection factories for resource adaptes
- Environment entries limited to String, Character, Byte, Short, Integer, Long, Boolean, Double, and Float.
Supporting resource injection on JavaServer Faces technology renderers, converters, or validators is not desirable because that would violate Model-View-Controller (MVC) separation of these presentation objects. If these classes need to get access to resources, they should do so through a managed beanIt is interesting to note that the Java standards emphasize Annotation-driven injection, while the Spring community which popularized dependency injection continues to ignore annotations as a means of injection, using XML descriptors instead.