Spring 配置 XML 模式:有还是没有版本?
我是春天的新手。让我感到困惑的一件事是,有时我看到XML配置文件具有版本化架构,但有时看到具有非版本化架构的XML配置文件。例如,有时我看到类似的东西
<?xml version="1.0" encoding="UTF-8"?>
<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-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd">
<context:annotation-config/>
<context:component-scan base-package="base.package"/>
</beans>
有时像这样:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<context:annotation-config/>
<context:component-scan base-package="base.package"/>
</beans>
请注意,在这两个示例中,和 架构是不同的。spring-beans
spring-context
所以,我的问题是,你会使用哪种风格,为什么?特别是,版本化架构将来是否会变得不可用,以及当Spring更新架构时,非版本化架构是否会与当前应用程序保持兼容?
一个附带的问题是,在哪里可以找到版本化弹簧模式的列表?