Summary
In this chapter, we provided an introduction to CDI, an integral part of the Jakarta EE specification. We looked into the following:
- We covered how Jakarta Faces pages can access CDI-named beans via the unified expression language.
- We also covered how CDI makes it easy to inject dependencies into our code via the
@
Inject
annotation. - Additionally, we explained how we can use qualifiers to determine what specific implementation of a dependency to inject into our code.
- We also discussed all the scopes that a CDI bean can be placed into, allowing us to delegate the life cycle of CDI beans to the Jakarta EE runtime.
- We discussed how to implement loosely coupled communication between CDI beans via CDI’s event handling.
- Lastly, we discussed CDI Lite, a lightweight version of CDI suitable for microservices development.
CDI is an integral part of Jakarta EE, as it is used to integrate different layers of our Jakarta EE applications.