beans.xml에서 유효한 네임스페이스가 있는지 확인합니다

beans.xml 파일에 데코레이터 또는 인터셉터가 포함되는 경우 적절한 인스턴스 생성을 위해 올바른 스키마를 사용해야 합니다. beans.xml 파일의 네임스페이스가 파일의 네임스페이스는 해당 CDI 버전의 사양과 일치해야 합니다.

이 규칙은 beans.xml 파일을 검사하여 유효한 네임스페이스가 제공되는지 확인합니다. 유효한 네임스페이스가 제공되었는지 확인합니다. xmlns 속성을 작성하거나 제거하지 마십시오.

다음 예는 CDI 1.0 스펙에 올바른 beans.xml 파일을 보여줍니다.


<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> 

다음 예는 CDI 1.2 스펙에 올바른 beans.xml 파일을 보여줍니다.


<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>
 

네임스페이스가 제공되지만 어느 스펙과도 일치하지 않는 경우, 서버는 beans.xml 파일을 처리할 때 예외 처리를 합니다. 다음 JVM 특성을 설정하여 유효성 검증을 사용 안함으로 설정할 수 있습니다.

		
	org.jboss.weld.xml.disableValidating=true

네임스페이스가 제공되지 않으면 이 규칙은 beans.xml 파일에 플래그를 지정하지 않습니다.

Java EE 7과 함께 제공되는 CDI 1.2의 사용을 고려 중인 경우 Contexts and Dependency Injection 1.2 동작 변경사항을 참조하십시오.