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

8. The Contexts and Dependency Injection (CDI) API

Luqman Saeed1 
(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 duty ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.