Contexts and Dependency Injection (CDI) defines a set of complementary services that help improve the structure of application code.

Core CDI specification is split into Lite and Full. Lite includes most of the features and is tailored for runtimes that don't intend to implement the entire Jakarta EE platform. Full includes features that are not deemed necessary for all CDI implementations. Jakarta EE implementations are required to support Full.

  • A well-defined lifecycle for stateful beans bound to well-defined lifecycle contexts, where the set of contexts is extensible
  • A sophisticated, typesafe dependency injection mechanism, including the ability to select dependencies at either development or deployment time, without verbose configuration
  • Support for Jakarta EE modularity and the Jakarta EE component architecture—the modular structure of a Jakarta EE application is taken into account when resolving dependencies between Jakarta EE components
  • Integration with the Unified Expression Language, allowing any bean to be used directly within a JSF or JSP page (only in Full)
  • The ability to decorate injected beans (only in Full)
  • The ability to associate jakarta.interceptor.Interceptor with beans via typesafe interceptor bindings
  • An event notification model
  • A web conversation context in addition to the three standard web contexts defined by the Java Servlets specification (only in Full)
  • A build-compatible SPI and a runtime SPI allowing portable extensions to integrate cleanly with the container (runtime SPI only in Full)

CDI allows objects to be bound to lifecycle contexts, to be injected, to be associated with interceptors and decorators, and to interact in a loosely coupled fashion by firing and observing events. Various kinds of objects are injectable, including EJB 3 session beans, managed beans, producer methods and Jakarta EE resources. We refer to these objects in general terms as beans and to instances of beans that are bound to contexts as contextual instances.

Modules 
Module Description
jakarta.cdi