[英]How to to prevent Spring to create an “abstract” generic type repository that is just to be extended?
如果我想做这样的事情:
public interface LongIdRepo<T> extends PagingAndSortingRepository<T, Long> {}
因为我想将其扩展为:
public interface MyRepo extends LongIdRepo<My> {}
这是不可能的,因为:
org.springframework.beans.factory.BeanCreationException:创建名称为'longIdRepo'的bean时出错:调用init方法失败; 嵌套异常为java.lang.IllegalArgumentException:不是托管类型:类java.lang.Object
有什么方法可以使Spring忽略LongIdRepo bean的创建吗?
试试这个@NoRepositoryBean注释
@NoRepositoryBean
public interface LongIdRepo<T> extends PagingAndSortingRepository<T, Long> {}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.