Skip to content

This repository holds the resources for our CDI Training

License

Notifications You must be signed in to change notification settings

Gepardec/cdi-training

Repository files navigation

CDI Training

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.

Covered CDI Basics

The following CDI concepts are covered by this example

  1. Injection

  2. Scopes

  3. Initialization (@PostConstruct, @PreDestroy)

  4. Qualifiers

  5. Producer Methods/Fields

  6. Interceptors

  7. Decorators

  8. Events

CDI Advanced

Additionally, to the CDI basics, this sample application provides implementations with explanations for situations we faced in our projects.

  1. Scopes and Concurrency
    How to provide request scoped state when using concurrency where we only can use @Dependent, @ApplicationScoped beans?

  2. Dynamic Default
    How to change the @Default of an CDI bean during runtime?

  3. Alternatives
    How and when to use @Alternative beans?

  4. Specialized
    How and when to use @Specialized beans, and what differs them from @Alternative beans?

  5. Registrar
    How to use a registrar to capture asynchronous executions results, which are needed by other parts of the application?

  6. Startup-Event
    How to notify the application about that the application has started?

  7. Lookup-Factory
    How to implement a factory to encapsulate the CDI programmatic bean lookup and how to manage @Dependent scoped beans properly?

Resources

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:

Used Tools

To get the application running you need the following software installed:

Accessing the application

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.

Running in an IDE

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.

WIKI

See the WIKI for the development guidelines and the documentation about the components the application is based on.

About

This repository holds the resources for our CDI Training

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published