Chapter 12. Using CDI with EJB 3

This chapter covers

  • Dependency injection for POJOs
  • Scopes and bean lifecycles
  • Core CDI constructs
  • Long-running conversations

Context and Dependency Injection (CDI) is an exciting new feature that was introduced with Java EE 6 and further extended in Java EE 7. CDI brings full-fledged dependency injection and context support to the Java EE platform. In earlier chapters you saw examples of resource injection using @PersistenceUnit, @Resource, and @EJB to inject resources as well as other EJBs. We’ve also delved into interceptors that provide basic AOP support. These powerful features, along with other innovations including JPA, have greatly simplified Java EE development.

But the innovations that were introduced ...

Get EJB 3 in Action, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.