PagingAndSortingRepository is a Spring Data contract for repositories that need both basic CRUD operations and the ability to sort records or retrieve them in pages. It extends CrudRepository, so choose it when CRUD alone is not enough. section 14.2
Define a repository interface that extends PagingAndSortingRepository to request these capabilities. Spring provides a bean implementing that contract for other application components to inject. If an application only needs CRUD, CrudRepository is the simpler choice. section 14.2
Figure 14.6 To implement your app’s repositories using Spring Data, you extend specific interfaces. The main interfaces that represent Spring Data contracts are Repository, CrudRepository, and PagingAndSortingRepository. You extend one of these contracts to implement your app’s persistence capabilities.

The diagram compares the main Spring Data repository contracts and shows where PagingAndSortingRepository fits. section 14.2
