spring的name space解析

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目录下,否则是加载不到的。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值