Contexts and Dependency Injection for the Java EE platform introduces a standard set of component management services to the Java EE platform.
As a component of Java EE 6, CDI is in many ways a standardization of concepts that have been brewing in Spring for a long time, such as dependency injection and interceptors. In fact, CDI and Spring 3 share many similar features.
CDI lets you decouple concerns by what it refers to as loose coupling and strong typing. In doing so, it provides an almost liberating escape from the banalities of everyday Java programming, allowing injections of its objects and controlling their lifetimes.
Tip
Why CDI is for Java EE?
If you have been programming with Java EE 5, you might argue that it already features resources injection of resources. However, this kind of injection can be used only for resources known to the container (for example, @EJB
, @PersistenceContext
, @PersistenceUnit
, and @Resource
). CDI, on the other...