Java 在Spring 3.1.0中使用Spring数据JPA
有人知道我如何使用SpringDataJPA和Spring3.1.0/3.1.1吗 SpringDataJPA1.0.3依赖于Spring3.0.5,所以当我添加SpringDataJPA作为依赖项时,我在使用3.1.0时会遇到冲突Java 在Spring 3.1.0中使用Spring数据JPA,java,spring,maven,spring-data-jpa,Java,Spring,Maven,Spring Data Jpa,有人知道我如何使用SpringDataJPA和Spring3.1.0/3.1.1吗 SpringDataJPA1.0.3依赖于Spring3.0.5,所以当我添加SpringDataJPA作为依赖项时,我在使用3.1.0时会遇到冲突 我尝试过使用maven excludes,但没有太大成功。我成功地将Spring数据JPA 1.0.3与Spring 3.1.0集成在一起。下面是一个剥离的pom.xml,看起来不错: <?xml version="1.0" encoding="UTF-8"?
我尝试过使用maven excludes,但没有太大成功。我成功地将Spring数据JPA 1.0.3与Spring 3.1.0集成在一起。下面是一个剥离的
pom.xml
,看起来不错:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.1.0.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.0.3.RELEASE</version>
</dependency>
</dependencies>
</project>
您有什么样的冲突?是的,您会遇到很多:
org.springframework:springbeans:jar:3.0.5.RELEASE:compile-因与3.1.0冲突而省略。RELEASE
-很好,maven选择更新的或显式声明的依赖项。功能,而不是bug:-)。您的最终工件将使用更新的版本。
$ mvn dependency:tree
com.example:example:jar:1.0.0-SNAPSHOT
+- org.springframework:spring-core:jar:3.1.0.RELEASE:compile
| +- org.springframework:spring-asm:jar:3.1.0.RELEASE:compile
| \- commons-logging:commons-logging:jar:1.1.1:compile
+- org.springframework:spring-aspects:jar:3.1.0.RELEASE:compile
| +- org.springframework:spring-beans:jar:3.1.0.RELEASE:compile
| +- org.springframework:spring-context:jar:3.1.0.RELEASE:compile
| | +- org.springframework:spring-aop:jar:3.1.0.RELEASE:compile
| | \- org.springframework:spring-expression:jar:3.1.0.RELEASE:compile
| \- org.springframework:spring-context-support:jar:3.1.0.RELEASE:compile
+- org.springframework:spring-orm:jar:3.1.0.RELEASE:compile
| +- org.springframework:spring-jdbc:jar:3.1.0.RELEASE:compile
| \- org.springframework:spring-tx:jar:3.1.0.RELEASE:compile
| \- aopalliance:aopalliance:jar:1.0:compile
+- org.springframework:spring-test:jar:3.1.0.RELEASE:test (scope not updated to compile)
\- org.springframework.data:spring-data-jpa:jar:1.0.3.RELEASE:compile
+- org.springframework.data:spring-data-commons-core:jar:1.1.0.RELEASE:compile
+- org.slf4j:slf4j-api:jar:1.6.1:compile
+- org.slf4j:jcl-over-slf4j:jar:1.6.1:runtime
\- org.aspectj:aspectjrt:jar:1.6.8:compile