Java Platform, Enterprise Edition (Java EE) 8
The Java EE Tutorial

Previous Next Contents

4 Injection

This chapter provides an overview of injection in Java EE and describes the two injection mechanisms provided by the platform: resource injection and dependency injection.

Java EE provides injection mechanisms that enable your objects to obtain references to resources and other dependencies without having to instantiate them directly. You declare the required resources and other dependencies in your classes by decorating fields or methods with one of the annotations that mark the field as an injection point. The container then provides the required instances at runtime. Injection simplifies your code and decouples it from the implementations of its dependencies.

The following topics are addressed here:

Previous Next Contents
Oracle Logo  Copyright © 2017, Oracle and/or its affiliates. All rights reserved.