type=page
status=published
title=Using Resource Adapters with Contexts and Dependency Injection for Java EE (CDI)
next=resources005.html
prev=resources003.html
~~~~~~
Using Resource Adapters with Contexts and Dependency Injection for Java EE (CDI)
================================================================================

[[CHDJFIGB]]

[[using-resource-adapters-with-contexts-and-dependency-injection-for-java-ee-cdi]]
Using Resource Adapters with Contexts and Dependency Injection for Java EE (CDI)
--------------------------------------------------------------------------------

For details about CDI, see link:cdi-basic.html#GIWHB[Chapter 25,
"Introduction to Contexts and Dependency Injection for Java EE"] and
link:cdi-adv.html#GJEHI[Chapter 27, "Contexts and Dependency Injection
for Java EE: Advanced Topics."]

Do not specify the following classes in the resource adapter as CDI
managed beans (that is, do not inject them), because the behavior of
these classes as CDI managed beans has not been portably defined.

* Resource adapter beans: These beans are classes that are annotated
with the `javax.resource.spi.Connector` annotation or are declared as
corresponding elements in the resource adapter deployment descriptor,
`ra.xml`.
* Managed connection factory beans: These beans are classes that are
annotated with the `javax.resource.spi.ConnectorDefinition` annotation
or the `javax.resource.spi.ConnectorDefinitions` annotation or are
declared as corresponding elements in `ra.xml`.
* Activation specification beans: These beans are classes that are
annotated with the `javax.resource.spi.Activation` annotation or are
declared as corresponding elements in `ra.xml`.
* Administered object beans: These beans are classes that are annotated
with the `javax.resource.spi.AdministeredObject` annotation or are
declared as corresponding elements in `ra.xml`.

Other types of classes in the resource adapter can be CDI managed beans
and will behave in a portable manner.
