【发布时间】:2020-07-21 17:04:16
【问题描述】:
我有自己的自定义存储库,但是当我尝试覆盖/使用 CrudRepository 时,它给了我“两种方法都有相同的擦除,但都没有覆盖另一个”。请看下文。
public interface MyRepository extends CrudRepository<Person, String> {
//<S extends T> S save(S entity); //Parent method
Person save(Person person);//It accepts this
//<S extends T> Iterable<S> saveAll(Iterable<S> entities);//Parent method
Iterable<Person> saveAll(Iterable<Person> persons);//But does not accept this. why can I not use/override this?
//This Gives error "both methods have same erasure, yet neither overrides the other"
}
【问题讨论】:
标签: java spring spring-boot spring-data-jpa spring-repositories