Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inner classes as spring-data-repositories

Tags:

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> {

    }
}

i cannot find any documentation on such a restriction. So my question is: Is it possible to define spring-data-repositories as inner-classes?

like image 282
cproinger Avatar asked Apr 23 '14 12:04

cproinger


1 Answers

You should set the considerNestedRepositories boolean to true.

like image 182
Lodewijk Bogaards Avatar answered Sep 26 '22 20:09

Lodewijk Bogaards