Home

CDIenabled

CDIenabled refers to software components or applications that are managed within a CDI-enabled container, allowing them to participate in the Contexts and Dependency Injection (CDI) programming model. CDI is a standard in Java for dependency injection, contextual lifecycle management, and event handling, designed to decouple components and simplify wiring and lifecycle concerns.

In practice, a CDI-enabled deployment is recognized by the presence of a CDI deployment descriptor, typically

Key features of CDI-enabled applications include dependency injection via @Inject, contextual lifecycles with scope annotations such

Usage typically involves annotating classes with CDI annotations and injecting dependencies where needed, for example injecting

See also: Contexts and Dependency Injection, CDI implementations, Jakarta EE.

beans.xml,
in
the
appropriate
location
(META-INF
for
libraries,
WEB-INF
for
web
applications).
Many
modern
application
servers
provide
built-in
CDI
support,
so
CDI
features
are
available
automatically
when
the
descriptor
is
present
or
when
the
server
exposes
CDI
runtime
capabilities.
Common
CDI
implementations
include
Weld
and
Apache
OpenWebBeans.
as
@RequestScoped,
@SessionScoped,
@ApplicationScoped,
and
@Dependent,
and
the
use
of
qualifiers
and
alternatives
to
select
specific
beans.
CDI
also
supports
producers
with
@Produces
to
create
objects
not
managed
directly
by
the
container,
events
via
@Observes
for
event-driven
interactions,
and
additional
mechanisms
such
as
interceptors,
decorators,
and
stereotypes
to
compose
behavior
and
configuration.
a
bean
into
a
service
or
event
handling
via
observers.
In
Java
SE
environments,
enabling
CDI
may
require
adding
a
CDI
implementation
as
a
dependency
and
providing
beans.xml,
while
Jakarta
EE
environments
include
CDI
as
part
of
the
platform.