12.3.3 Changes in CDI
- Organization of this subsection
(1) Changes in the conditions to determine whether CDI is enabled when beans.xml is omitted
In Application Server version 11 and Developer version 11, the handling of the beans.xml file and the conditions to determine whether CDI is enabled were changed in association with the support for the CDI 1.2 specifications.
Under the CDI 1.2 specifications, CDI is automatically enabled when the CDI annotation is determined to be used even if the application archive does not include beans.xml. For this reason, if an application that could be deployed in Application Server version 9 and Developer version 9 does not expect CDI to be enabled, it might fail to be deployed in Application Server version 11 and Developer version 11.
The CDI 1.2 specifications stipulate to provide an option for restoring the determination conditions to the CDI 1.0 criteria to avoid such a situation. Application Server version 11 and Developer version 11 also provide that option. To restore the conditions to determine whether CDI is enabled to the CDI 1.0 criteria, add the following definition to the user property file for J2EE servers.
ejbserver.javaee.cdi.beansXmlRequired=true
(2) Changes in the handling of Portable Extension APIs
In Application Server version 9 and Developer version 9, CDI's Portable Extension APIs were not supported, and ignored even if the implementation class of Portable Extension existed in the class path.
Although Application Server version 11 and Developer version 11 continue to not support the use of Portable Extension APIs by user applications, the implementation class of Portable Extension runs because CDI's Portable Extension APIs are used within the product.
For the JAR file that stores the implementation class of Portable Extension (a class that implements the javax.enterprise.inject.spi.Extension interface) and its service definition file (META-INF/services/javax.enterprise.inject.spi.Extension file), do not add it to the class path of the J2EE server and do not store it in the application. Failure to follow this instruction might cause the implementation class of Portable Extension to run, causing the application to fail to be deployed or changing the behavior of the application.