diff --git a/docs/src/main/asciidoc/spring-data-jpa.adoc b/docs/src/main/asciidoc/spring-data-jpa.adoc index 52c20b03c83e4..b04961054c577 100644 --- a/docs/src/main/asciidoc/spring-data-jpa.adoc +++ b/docs/src/main/asciidoc/spring-data-jpa.adoc @@ -416,7 +416,9 @@ Interfaces that extend any of the following Spring Data repositories are automat * `org.springframework.data.repository.Repository` * `org.springframework.data.repository.CrudRepository` +* `org.springframework.data.repository.ListCrudRepository` * `org.springframework.data.repository.PagingAndSortingRepository` +* `org.springframework.data.repository.ListPagingAndSortingRepository` * `org.springframework.data.jpa.repository.JpaRepository` The generated repositories are also registered as beans so they can be injected into any other bean. diff --git a/docs/src/main/asciidoc/spring-data-rest.adoc b/docs/src/main/asciidoc/spring-data-rest.adoc index e3e95121e920e..e83aeb064e2c1 100644 --- a/docs/src/main/asciidoc/spring-data-rest.adoc +++ b/docs/src/main/asciidoc/spring-data-rest.adoc @@ -327,7 +327,7 @@ The former is used by default, but it is highly recommended to specify which one If a database contains many entities, it might not be a great idea to return them all at once. `PagingAndSortingRepository` allows the `spring-data-rest` extension to access data in chunks. -Replace the `CrudRepository` with `PagingAndSortingRepository` in the `FruitsRepository`: +So, you can extend the `PagingAndSortingRepository`: [source,java] ---- @@ -335,7 +335,7 @@ package org.acme.spring.data.rest; import org.springframework.data.repository.PagingAndSortingRepository; -public interface FruitsRepository extends PagingAndSortingRepository { +public interface FruitsRepository extends CrudRepository, PagingAndSortingRepository { } ---- @@ -362,6 +362,19 @@ Now the `GET /fruits` will accept three new query parameters: `sort`, `page` and For paged responses, `spring-data-rest` also returns a set of link headers that can be used to access other pages: first, previous, next and last. +Additionally, rather than extending both `PagingAndSortingRepository` and `CrudRepository`, you can use `JpaRepository`, which is a higher-level abstraction tailored for JPA. Since `JpaRepository` already extends both `PagingAndSortingRepository` and `CrudRepository`, it can replace `CrudRepository` directly. + +[source,java] +---- +package org.acme.spring.data.rest; + +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface FruitsRepository extends JpaRepository { +} +---- + + ==== Fine tuning endpoints generation This allows user to specify which methods should be exposed and what path should be used to access them.