我有以下JPA存储库:
public interface ProductRepositoryJPA extends CrudRepository<Product,String>,
PagingAndSortingRepository<Product,String> {
@Override
@EntityGraph(value="EVERYTHING", type= EntityGraph.EntityGraphType.FETCH)
Product findOne(String id);
}如果我尝试使用spring-boot 2.0.0.M4进行编译,我会遇到以下错误:
ProductRepositoryJPA.java:[21,5] method does not override or implement a method from a supertype如果我使用Spring Boot 1.5.6.RELEASE,代码编译得很好。
如果我删除@Override注释并将Spring Boot保持在2.0.0.M3版本,它也可以很好地编译。
下面是我对Spring Boot 2.0.0.M3的依赖关系树:
-- maven-dependency-plugin:2.10:tree (default-cli) @ example-load ---
[INFO] com.example.product-load:jar:1.0-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.0.0.M4:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.0.0.M4:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:2.0.0.M4:compile
[INFO] | \- org.springframework:spring-core:jar:5.0.0.RC4:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.0.0.RC4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j:jar:1.2.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.0.0.M4:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.0.0.M4:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.0.0.M4:test
[INFO] | \- org.springframework:spring-test:jar:5.0.0.RC4:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.0.0.M4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:2.0.0.M4:compile
[INFO] | | \- org.springframework:spring-aop:jar:5.0.0.RC4:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.0.0.M4:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:5.0.0.RC4:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:2.0.0.RC3:compile
[INFO] | | +- org.springframework:spring-orm:jar:5.0.0.RC4:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.0.0.RC4:compile
[INFO] | \- org.springframework:spring-aspects:jar:5.0.0.RC4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:2.0.0.M4:compile
[INFO] \- org.springframework.data:spring-data-elasticsearch:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-context:jar:5.0.0.RC4:compile
[INFO] | \- org.springframework:spring-expression:jar:5.0.0.RC4:compile
[INFO] +- org.springframework:spring-tx:jar:5.0.0.RC4:compile
[INFO] \- org.springframework.data:spring-data-commons:jar:2.0.0.RC3:compile和我的Spring-Boot 1.5.6.RELEASE依赖树:
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.5.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.5.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.6.RELEASE:compile
[INFO] | \- org.springframework:spring-core:jar:4.3.10.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-log4j:jar:1.2.8.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.6.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.6.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.6.RELEASE:test
[INFO] | \- org.springframework:spring-test:jar:4.3.10.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.6.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-aop:jar:4.3.10.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.6.RELEASE:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.10.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.6.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:4.3.10.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:4.3.10.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.3.10.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-elasticsearch:jar:1.5.6.RELEASE:compile
[INFO] \- org.springframework.data:spring-data-elasticsearch:jar:3.0.0.RC3:compile
[INFO] +- org.springframework:spring-context:jar:4.3.10.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.3.10.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.3.10.RELEASE:compile
[INFO] \- org.springframework.data:spring-data-commons:jar:1.13.6.RELEASE:compile谢谢!
发布于 2017-09-30 07:35:08
在注释掉我的“覆盖”方法后,为了允许使用Spring-Boot-2.0.0.M4编译构建,我意识到在spring-data-commons 2.0.0中不再支持findOne( the )。它似乎已经被findById(T id)方法所取代。
https://stackoverflow.com/questions/46498038
复制相似问题