The beginning of my working bean.xml file looks like the following:
<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">
I happened to put the following URL http://www.springframework.org/schema/beans
which returned a list that looks like the following
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
I downloaded spring-beans-4.2.xsd and spring-beans.xsd and did a diff on them. They seem to be identical. Therefore, should I specify spring-beans-4.2.xsd or spring-beans.xsd. Two concerns come to mind. 1. If I use spring-beans.xsd then it would seem that I would always get the latest version. This could be good if they are always backward compatible. 2. Referring to #1 this could be bad because something may change in the .xsd and break my validation.
My feeling is to lock in the .xsd with spring-beans-4.2.xsd and change the bean.xml file when I am ready. Thoughts on this observation would be greatly appreciated.
我宁愿指定特定版本,因为有时存在依赖项冲突问题,因此http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
应该可以。
The advice for some time now has been to use the versionless schema, especially now Spring 5 has been released, which doesn't have a versioned schema (See [SPR-13499] )
A more complete answer can be found at Spring configuration XML schema: with or without version?
THis question should have been closed as a duplicate of that question, but it's too late to do that now.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.