spring命名空间的解析步骤:
1. 解析XML,找到所有的命名空间,如: http://www.springframework.org/schema/context
2. 在Classpath中查找所有的 spring.handlers 并解析其中配置的命名空间所对应的解析类, 如:
http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler
3. 根据查找到的解析Handler去解析配置文件中相应的结点.
而命名空间对应的xsd文件, 则是在 spring.schemas 中指定的, 如:
http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd
参考:http://blog.csdn.net/caolaosanahnu/article/details/7963086
xsd报错: - schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-
security-3.1.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the
document is not <xsd:schema>
解决:spring版本不同:
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
基于Spring可扩展Schema提供自定义配置支持
参考:http://blog.csdn.net/wxyfighting/article/details/9068701
需要注意的地方:
1、spring.handlers和spring.schemas中内容的写法:
http\://blog.csdn.net/cutesource/schema/people.xsd=META-INF/people.xsd
2、META-INF需要放入classpath中,也就是classes目录下,否则是加载不到的。