It seems that Spring Data 3.0 has now separated the "Sorting" repositories from the base ones (i.e. PagingAndSortingRepository
and other interfaces don't extend CrudRepository
anymore), and so, we have to make our repositories extend more than one framework repo interfaces, combining them as we want to.
A cause for this is that Spring Data JPA has introduced a ListCrudRepository
interface now that retrieves List
results instead of Iterable
as the CrudRepository
did (which in many cases was a pain to deal with).
So, with this unbinding, we can now choose to combine PagingAndSortingRepository
with CrudRepository
as was the previous behavior, or instead use it with ListCrudRepository
:
public interface FooRepository extends
PagingAndSortingRepository<Foo, Long>,
CrudRepository<Foo, Long> {}
All this is explained in this Spring Data Announcement post, and also in the Spring Data 3.0 docs:
Note that the various sorting repositories no longer extended their respective CRUD repository as they did in Spring Data Versions pre 3.0. Therefore, you need to extend both interfaces if you want functionality of both.