【发布时间】:2015-11-02 18:57:19
【问题描述】:
在我们的 spring 配置中,我们这样放置 beans 标签:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
现在 spring 必须从我的 calsspath 中找出文件 spring-beans.xsd 和 spring-context.xsd 的位置。
我在这个路径找到了一些 xsd 文件:
spring-context-4.1.5.RELEASE.jar/org/springframework/context/config
spring-context-2.5.xsd
spring-context-3.0.xsd
spring-context-3.1.xsd
spring-context-3.2.xsd
spring-context-4.0.xsd
spring-context-4.1.xsd
在搜索 spring-beans.xsd 文件时,我在此路径中找到了一些文件:
spring-beans-4.1.5.RELEASE.jar/org/springframework/beans/factory/xml
spring-beans-2.5.xsd
spring-beans-3.0.xsd
spring-beans-3.1.xsd
spring-beans-3.2.xsd
spring-beans-4.0.xsd
spring-beans-4.1.xsd
spring 将如何知道在哪里查找此文件,因为我的 beans 标记中的架构位置与此文件的实际位置之间没有链接。我也能找到像spring-beans-<version>.xsd 这样的文件,那么即使我们没有在<beans> 标签中指定任何版本,spring 也将知道spring-beans.xsd 是什么。
【问题讨论】: