concept bean - discovery - mode annotation in category ejb

appears as: be-discovery-mode annotation, The be-discovery-mode annotation
EJB 3 in Action, Second Edition

This is an excerpt from Manning's book EJB 3 in Action, Second Edition.

The beans.xml file has been vital to CDI up until Java EE 7. Now the Java EE 7 specification has made the beans.xml file optional. It’s been replaced with the bean-discovery-mode annotation in the deployment descriptor. We’ll look at this annotation next.

13.5.3. Using the bean-discovery-mode annotation

Once the beans.xml file could remain empty, and it served only as a marker for CDI; requests have been made to remove it altogether. The Java EE 7 specification has done just that. The bean-discovery-mode annotation has defined three modes that CDI uses to scan your classes in Java EE 7 applications. Table 13.3 describes these modes.

Table 13.3. Values for the bean-discovery-mode annotation

Value

Description

ALL All types are processed. This behavior is the same as including the beans.xml in a Java EE 6 application.
ANNOTATED Only types with bean-defining annotations are processed. This is the default Java EE 7 behavior.
NONE All types in the archive (JAR) will be ignored.