本文介绍了作为 spring-data-repositories 的内部类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
spring-data 似乎只为顶层定义的接口构造存储库.例如
It seems that spring-data only constructs repositories for interfaces that are defined at the top level. For example
public interface EmployeeRepository extends PagingAndSortingRepository<Employee, Long> {
}
效果很好,但如果我将它嵌入到一个类中,例如
works great but if i embed it into a class for example
public class Repositories {
public static interface EmployeeRepository extends PagingAndSortingRepository<Employee, Long> {
}
}
我找不到有关此类限制的任何文档.所以我的问题是:是否可以将 spring-data-repositories 定义为内部类?
i cannot find any documentation on such a restriction. So my question is: Is it possible to define spring-data-repositories as inner-classes?
推荐答案
你应该设置 考虑NestedRepositories布尔值为真.
You should set the considerNestedRepositories boolean to true.
这篇关于作为 spring-data-repositories 的内部类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!