spring的shema文件如何读取
spring的shema文件如何读取
的配置文件的beans 里面有属性头部如下:
XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
xmlns:xxx 就是定义一个 xxx前缀命名空间。然后下面可以如此定义 ,当然apple 是在shema文件中声明好的。shema 文件在哪里找?就是后面的 xsi: 里,其里面的值是成对出现的。
key 是前头通过 xmlns:xxx 定义时的值,如上面的“”spring配置文件头部,value 是一个url地址(当然其实也可以是非url字符串),那么是如何读取这个url对应的shema文件的呢?会扫描所有的jar文件spring配置文件头部,查找 jar文件里/META-INF/ 下面的 . 和 . 2个文件。
. 文件是定义 使用哪个class类来解析该段 xml内容spring的shema文件如何读取,形如:
http\://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler
. 文件里定义的是 文件的真实地址(基于的)
http\://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd http\://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd http\://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd http\://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.0.xsd
故spring配置文件头部spring的shema文件如何读取,其实在断网的情况下,肯定也是可以正常启动的。