The Contexts and Dependency Injection (CDI) 1.1 specification introduced implicit bean discovery mode, resulting in behavior and performance changes from the Java Platform, Enterprise Edition (Java EE) 6 CDI 1.0 implementation in WebSphere Application Server.
This rule flags the WEB-INF or META-INF folder if the project does not contain a beans.xml file. When moving from Java EE 6 CDI 1.0 to Java EE 7 CDI 1.1 or later, implicit bean discovery results in all WAR and JAR files being scanned by the runtime, even if they do not have a beans.xml file. This can lead to bean discovery performance degradation if you enable the cdi-1.2 feature on Liberty.
In Java EE 7, if no beans.xml file is defined, the runtime automatically scans for bean-defining annotations. To disable this behavior, add a beans.xml file with bean discovery mode set to none, as shown in the following example.
<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"
bean-discovery-mode="none" version="1.1">
</beans>
On Liberty, you can also disable this behavior by adding the following property to the server.xml file.
<cdi12 enableImplicitBeanArchives="false"/>
On WebSphere Application Server traditional, this behavior can be disabled in the following ways:
enableImplicitBeanArchives custom property to false disables CDI-related
annotation scanning steps for archives that do not contain a bean descriptor such as the beans.xml file.
enableCDI custom property to false, disables all CDI steps. This value
should be set to false if no CDI is needed on the server level.
For more information on setting these properties in WebSphere traditional, see the Custom Properties for improving application startup in WebSphere Application Server documentation.
For more information on the Java EE 7 CDI 1.2 implementation, see Contexts and Dependency Injection 1.2 behavior changes.