Java 在springbean.xml中指定xsd的正确方法是什么
我的工作bean.xml文件的开头如下所示:Java 在springbean.xml中指定xsd的正确方法是什么,java,xml,spring,xsd,Java,Xml,Spring,Xsd,我的工作bean.xml文件的开头如下所示: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xsi:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.2.xsd">
我下载了spring-beans-4.2.xsd和spring-beans.xsd,并对它们进行了比较。他们似乎一模一样。因此,我应该指定spring-beans-4.2.xsd还是spring-beans.xsd。
我想到了两个问题。
1.如果我使用spring-beans.xsd,那么我似乎总能得到最新版本。如果它们总是向后兼容,这可能会很好。
2.提到#1,这可能是不好的,因为.xsd中可能会发生一些变化,并破坏我的验证
我的感觉是用spring-beans-4.2.xsd锁定.xsd,并在准备好后更改bean.xml文件。对这一观察的想法将不胜感激。我更愿意指定特定的版本,因为有时会出现依赖冲突的问题,所以
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
应该可以。谢谢。这也是我的想法。
spring-beans-2.0.xsd
spring-beans-2.5.xsd
spring-beans-3.0.xsd
spring-beans-3.1.xsd
spring-beans-4.0.xsd
spring-beans-4.1.xsd
spring-beans-4.2.xsd
spring-beans.xsd