问题在于你正在混合使用不同版本的Spring,在项目中混合使用了(2.0.8、3.1.4和4.0.2)。那是等待发生的麻烦。
为防止此类情况,现在可以导入一个所谓的”bill of materials” POM。
你需要添加dependencyManagement部分以导入BOM。
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-framework-bom</artifactId> <version>4.0.5.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies></dependencyManagement>
现在,在依赖项中,你可以删除版本并替换
spring-dao为
spring-orm。额外的好处是,所有
spring- *依赖项现在都将被管理到最新版本,并且你的版本号只有一个位置。
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId></dependency><dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId></dependency>
你可以对Spring Data应用相同的技巧,因为它也具有bom。



