Configuring a CDI Application (original) (raw)
When your beans are annotated with a scope type, the server recognizes the application as a bean archive and no additional configuration is required. The possible scope types for CDI beans are listed inUsing Scopes.
CDI uses an optional deployment descriptor named beans.xml
. Like other Java EE deployment descriptors, the configuration settings inbeans.xml
are used in addition to annotation settings in CDI classes. The settings in beans.xml
override the annotation settings if there is a conflict. An archive must contain the beans.xml
deployment descriptor only in certain limited situations, described inChapter 27, "Contexts and Dependency Injection for Java EE: Advanced Topics".
For a web application, the beans.xml
deployment descriptor, if present, must be in the WEB-INF
directory. For EJB modules or JAR files, the beans.xml
deployment descriptor, if present, must be in theMETA-INF
directory.