If a beans.xml file includes decorators or interceptors, a valid schema must be used for proper instantiation. The namespace and schema location in the beans.xml file must match the specification for the applicable CDI version.
This rule scans beans.xml files to see if a
valid namespace is provided on the xmlns attribute. If the namespace is
valid, the rule also verifies that the corresponding schema location on the schemaLocation attribute is correct.
The following example shows a valid beans.xml file for the CDI 1.0 specification.
|
The following example shows a valid beans.xml file for the CDI 1.2 specification.
|
If a namespace is provided and it does not match either specification, the server throws an exception when processing the beans.xml file. You can disable validation by setting the following JVM property:
org.jboss.weld.xml.disableValidating=true
If no namespace is provided, the rule does not flag the beans.xml file.
The automated fix for this rule updates incompatible namespaces with the value appropriate to the specified schemaLocation. Copy the custom configuration to your application build file to enable the fix automation.
If you are considering using CDI 1.2 provided with Java EE 7, see Contexts and Dependency Injection 1.2 behavior changes.