This repository holds the sample application which covers the main concepts of the CDI 3.0 specification. After working through the tasks one should be able to understand the main concepts of the CDI 3.0 specification and to use the CDI 3.0 concepts in real time applications.
The application is based on the Jakarta-EE 9 (CDI 3.0) specification and the Wildfly 26.1.0.Final application server.
The following CDI concepts are covered by this example
-
Injection
-
Scopes
-
Initialization (
@PostConstruct, @PreDestroy
) -
Qualifiers
-
Producer Methods/Fields
-
Interceptors
-
Decorators
-
Events
Additionally, to the CDI basics, this sample application provides implementations with explanations for situations we faced in our projects.
-
Scopes and Concurrency
How to provide request scoped state when using concurrency where we only can use@Dependent, @ApplicationScoped
beans? -
Dynamic Default
How to change the@Default
of an CDI bean during runtime? -
Alternatives
How and when to use@Alternative
beans? -
Specialized
How and when to use@Specialized
beans, and what differs them from@Alternative
beans? -
Registrar
How to use a registrar to capture asynchronous executions results, which are needed by other parts of the application? -
Startup-Event
How to notify the application about that the application has started? -
Lookup-Factory
How to implement a factory to encapsulate the CDI programmatic bean lookup and how to manage@Dependent
scoped beans properly?
This repository provides the following pdf slides:
-
CDI Introduction
An introduction to CDI. -
CDI Specs
A theoretical insight into the CDI specs scopes, interceptors, decorators and events.
The following resources are useful when implementing CDI backed applications:
-
CDI 3.0 Specification
The official CDI 3.0 specification of Jakarta EE
To get the application running you need the following software installed:
The application can be accessed via http://localhost:8080/cditraining/api/welcome
.
Follow the instructions to work through the exercises.
Important
|
When running in an IDE the actual port will depend on your configuration. |
Refer to the documentation of the IDE of your choice, which must provide integration for Wildfly/JBoss servers, for how to set up the project.
See the WIKI for the development guidelines and the documentation about the components the application is based on.