使用Maven时有可能意外地混合使用不同版本的Spring JARs。例如,您可能会发现一个第三方库或其他Spring项目,在传递依赖到一个旧版本。如果你忘了你自己明确地声明一个直接的依赖,会出现各种意想不到的问题。
这时候可以在dependencyManagement节点添加一个Spring 物料清单 来统一整个项目的Spring版本
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
在后面的dependencies节点里都可以不用添加version节点了
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependencies>