Spring数据和Querydsl的通用代码失败了

You*_*sef 8 spring hibernate querydsl spring-data

我使用querydsl这就是为什么我不需要方法findByName(),我的所有存储库接口都是空的.

所以我尝试制作genric代码以避免重复的空方法接口,因为我在hibernate映射的实体中有很多类.

public interface GenericResposotory<T> 
              extends JpaRepository<T, Integer>, QueryDslPredicateExecutor<T> {

}
Run Code Online (Sandbox Code Playgroud)

当我运行我的服务器时,我收到此错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'genericResposotory': 
Invocation of init method failed; nested exception is 
java.lang.IllegalArgumentException: Not an managed type: class java.lang.Object
Run Code Online (Sandbox Code Playgroud)

还有没有办法像我尝试做一个通用的存储库?

Nad*_*dir 2

Spring data 尝试为您创建的所有扩展 JpaRepository 的接口创建 bean。如果您想要一种不会被使用的基础存储库,请使用@NoRepositoryBean标记您的接口