12.4 Using the DI

Dependency Injection (DI) is a functionality with which the EJB container automatically sets the references to the Enterprise Beans and resources, by specifying the @EJB and @Resource annotations in the fields and the setter method of the EJBs and interceptor classes. If you use the DI, the references to the Enterprise Beans and resources need not be looked up by using the JNDI. This section describes the types of resources that can be specified in the @Resource annotation, the resolution of the resource references using the @Resource annotation, and the notes on the DI.

The following table describes the organization of this section.

Table 12-5 Organization of this section (Using the DI)

CategoryTitleReference location
ExplanationTypes of resources that can be specified in the @Resource annotation12.4.1
Resolving the resource references using the @Resource annotation12.4.2
Operations during DI failure12.4.3
NotesNotes12.4.4

Note: The functionality-specific explanation is not available for "Implementation", "Settings", and "Operations".


Organization of this section
12.4.1 Types of resources that can be specified in the @Resource annotation
12.4.2 Resolving the resource references using the @Resource annotation
12.4.3 Operations during DI failure
12.4.4 Notes