© Luqman Saeed 2020
Luqman SaeedIntroducing Jakarta EE CDIhttps://doi.org/10.1007/978-1-4842-5642-8_8

8. The Contexts and Dependency Injection (CDI) API

Luqman Saeed
(1)
Accra, Ghana
 
Dependency injection (DI) is a way of developing software such that various components are related in a very loosely coupled way. In most software applications, there is always some form of dependency between the various bits and pieces.
Take a restaurant application for instance. You might have a component that handles taking orders, another for sending a message to the kitchen, yet another for checking available ingredients for a given meal, and one or two for calculating the total bill.
These are all various components that need to depend on each other to fulfill the ...

Get Introducing Jakarta EE CDI: Contexts and Dependency Injection for Enterprise Java Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.