Sep 13, 2018

CDI bean-discovery-mode

The bean discovery mode is set in the bean.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" version="1.1" bean-discovery-mode="all"> ... </beans>
The bean-discovery-mode property can take one of three values: ALL, NONE, or ANNOTATED.

The ALL property instructs the CDI container to manage all beans that it finds in the archive. This is the default.

The NONE property means that the CDI container will manage no beans.

The ANNOTATED property makes the archive behave like an implicit archive. In this case, the container scans for beans with annotated scope types.

An implicit bean archive does not contain a bean.xml deployment descriptor. This signals to the CDI container that the container should only manage beans with a scope.