Contexts and Dependency Injection in Java EE 6
By user12600920 on Apr 12, 2011
"Java Platform, Enterprise Edition (Java EE) 5 brought dependency injection (DI) with Convention over Configuration to Enterprise JavaBeans (EJB) 3.0. Java EE 6 introduces the flexible and powerful @Inject dependency injection model (JSR-330 and JSR-299) in addition to the already existing @EJB annotation. So when should you use what?"
Contexts and Dependency Injection (CDI), the new Java EE 6 specification, introduces the concept of "contextual" references or scopes. Managed beans in CDI live in well-defined scope and are created and destroyed on demand by the container. Adam Bien articulates the best ways to qualify and to configure the dependencies using typed annotations, known as "qualifiers" with optional attributes instead of plain strings.
All in all, Bien gives us a detailed understanding of an important step forward in Java EE. See the story here.
