简体   繁体   中英

Unresolved Dependency error in Eclipse

I keep getting the following error in eclipse for a simple Repository interface.

The type org.springframework.data.repository.query.QueryByExampleExecutor
cannot be resolved.
It is indirectly referenced from required .class files

Its a Play Framework 2.5.1 project with MongoDB. Here're the dependencies in build.sbt.

libraryDependencies ++= Seq( javaCore, javaJpa, "javax.inject" % "javax.inject" % "1", "org.springframework" % "spring-core" % "4.3.3.RELEASE", "org.springframework" % "spring-context" % "4.3.3.RELEASE", "org.springframework" % "spring-beans" % "4.3.4.RELEASE" "org.springframework" % "spring-jdbc" % "4.3.4.RELEASE", "org.springframework.data" % "spring-data-jpa" % "1.10.1.RELEASE", "org.springframework.data" % "spring-data-commons-core" % "1.4.1.RELEASE", "org.springframework" % "spring-expression" % "4.3.3.RELEASE", "org.mongodb" % "mongo-java-driver" % "3.2.2", "org.springframework.data" % "spring-data-mongodb" % "1.9.2.RELEASE", "org.mockito" % "mockito-core" % "1.9.5" % "test" )

这是我的UserRepository界面 UserRepository接口错误

Could someone help me solve this issue

The problem is with the spring data commons dependency referenced by spring-data-jpa 1.10.1 Release version.

https://github.com/spring-projects/spring-data-jpa/blob/1.10.1.Release/pom.xml

The pom.xml has a dependency on 1.12.1.RELEASE and infact QueryByExampleExecutor javadocs suggest this class was added in 1.12 release.

The spring data commons version you've referenced is old 1.4.1.Release. So the fix for now would be to upgrade the spring data version to 1.12.1. The other fix could be to downgrade the spring-data-jpa to a version which uses spring data commons 1.4.1.Release version.

Btw you should look into using dependency management tool like Maven to avoid these kinds of problem in future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM