...

/

Contexts and Dependency Injection Framework

Contexts and Dependency Injection Framework

Learn how to replace Spring annotations with CDI annotations.

We'll cover the following...

Contexts and Dependency Injection (CDI) is an interface that standardizes dependency injection for Java EE. It defines different annotations for dependency injection like @Named, @Inject, @Scope, @Singleton, etc. Different CDI implementation frameworks provide support and functionality for these annotations.

@Named is used to define a bean and @Inject is used for autowiring one bean into another. Spring supports most of the annotations defined by CDI.

For the code example shown in this lesson, we have created a sub-package called lesson12 inside the package ...