Chapter 6. Contexts and Dependency Injection

Contexts and Dependency Injection (CDI) can be used to simplify integrating the different layers of a Java EE application. For example, CDI allows us to use a session bean as a managed bean, so that we can take advantage of the EJB features, such as transactions, directly in our managed beans.

In this chapter, we will cover the following topics:

  • Introduction to CDI
  • Qualifiers
  • Stereotypes
  • Interceptor binding types
  • Custom scopes

Introduction to CDI

JavaServer Faces (JSF) web applications employing CDI are very similar to JSF applications without CDI; the main difference is that instead of using JSF managed beans for our model and controllers, we use CDI named beans. What makes CDI applications easier to develop ...

Get Java EE 7 Development with NetBeans 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.