Si un fichier beans.xml inclut des décorateurs ou des intercepteurs, un schéma valide doit être utilisé pour une instanciation correcte. L'espace de nom et l'emplacement du schéma dans le fichier beans.xml doivent se conformer à la spécification pour la version CDI applicable.
This rule scans beans.xml files to see if the
namespace provided in the xmlns correspond à
l'emplacement du schéma correspondant sur le schemaLocation Attribut.
L'exemple suivant illustre un fichier beans.xml valide pour la spécification CDI 1.0.
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
L'exemple suivant illustre un fichier beans.xml valide pour la spécification CDI 1.2.
<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="all" version="1.1">
</beans>
Si aucun espace de nom n'est fourni, la règle ne marque pas le fichier beans.xml.
Le correctif automatisé de cette règle met à jour les espaces de nom incompatibles avec la valeur appropriée à l' schemaLocationspécifié. Copiez la configuration personnalisée vers votre fichier de génération d'application pour activer l'automatisation des correctifs.
Si vous envisagez d'utiliser la fonction CDI 1.2 fournie avec Java EE 7, voir Changements de comportement dans Contexts and Dependency Injection d'une édition à l'autre.