Contexts and Dependency Injection (CDI) was added to the Java EE specification in Java EE 6. Java EE 8 includes a new version of CDI, which adds new features such as asynchronous events and event ordering. CDI provides several advantages that were previously unavailable to Java EE developers, such as allowing any JavaBean to be used as a JSF managed bean, including stateless and stateful session beans. As its name implies, CDI simplifies dependency injection in Java EE applications.
In this chapter, we will cover the following topics:
- Named beans
- Dependency injection
- Scopes
- Qualifiers
- CDI events