diff --git a/pom.xml b/pom.xml
index a43ca5f89b..2c19dcc919 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.springframework.dataspring-data-commons
- 3.0.0-SNAPSHOT
+ 3.0.0-2537-split-pagingandsortingrep-SNAPSHOTSpring Data Core
diff --git a/src/main/asciidoc/repositories.adoc b/src/main/asciidoc/repositories.adoc
index d1ab4600c8..e6b75117fc 100644
--- a/src/main/asciidoc/repositories.adoc
+++ b/src/main/asciidoc/repositories.adoc
@@ -58,13 +58,13 @@ public interface CrudRepository extends Repository {
NOTE: We also provide persistence technology-specific abstractions, such as `JpaRepository` or `MongoRepository`.
Those interfaces extend `CrudRepository` and expose the capabilities of the underlying persistence technology in addition to the rather generic persistence technology-agnostic interfaces such as `CrudRepository`.
-On top of the `CrudRepository`, there is a https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/PagingAndSortingRepository.html[`PagingAndSortingRepository`] abstraction that adds additional methods to ease paginated access to entities:
+Additional to the `CrudRepository`, there is a https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/PagingAndSortingRepository.html[`PagingAndSortingRepository`] abstraction that adds additional methods to ease paginated access to entities:
.`PagingAndSortingRepository` interface
====
[source,java]
----
-public interface PagingAndSortingRepository extends CrudRepository {
+public interface PagingAndSortingRepository {
Iterable findAll(Sort sort);
@@ -210,17 +210,35 @@ The sections that follow explain each step in detail:
To define a repository interface, you first need to define a domain class-specific repository interface.
The interface must extend `Repository` and be typed to the domain class and an ID type.
-If you want to expose CRUD methods for that domain type, extend `CrudRepository` instead of `Repository`.
+If you want to expose CRUD methods for that domain type, you may extend `CrudRepository`, or one of its variants instead of `Repository`.
[[repositories.definition-tuning]]
=== Fine-tuning Repository Definition
-Typically, your repository interface extends `Repository`, `CrudRepository`, or `PagingAndSortingRepository`.
-Alternatively, if you do not want to extend Spring Data interfaces, you can also annotate your repository interface with `@RepositoryDefinition`.
-Extending `CrudRepository` exposes a complete set of methods to manipulate your entities.
-If you prefer to be selective about the methods being exposed, copy the methods you want to expose from `CrudRepository` into your domain repository.
+There are a few variants how you can get started with your repository interface.
-NOTE: Doing so lets you define your own abstractions on top of the provided Spring Data Repositories functionality.
+The typical approach is to extend `CrudRepository`, which gives you methods for CRUD functionality.
+CRUD stands for Create, Read, Update, Delete.
+With version 3.0 we also introduced `ListCrudRepository` which is very similar to the `CrudRepository` but for those methods that return multiple entities it returns a `List` instead of an `Iterable` which you might find easier to use.
+
+If you are using a reactive store you might choose `ReactiveCrudRepository`, or `RxJava3CrudRepository` depending on which reactive framework you are using.
+
+If you are using Kotlin you might pick `CoroutineCrudRepository` which utilizes Kotlin's coroutines.
+
+Additional you can extend `PagingAndSortingRepository`, `ReactiveSortingRepository`, `RxJava3SortingRepository`, or `CoroutineSortingRepository` if you need methods that allow to specify a `Sort` abstraction or in the first case a `Pageable` abstraction.
+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.
+
+If you do not want to extend Spring Data interfaces, you can also annotate your repository interface with `@RepositoryDefinition`.
+Extending one of the CRUD repository interfaces exposes a complete set of methods to manipulate your entities.
+If you prefer to be selective about the methods being exposed, copy the methods you want to expose from the CRUD repository into your domain repository.
+When doing so, you may change the return type of methods.
+Spring Data will honor the return type if possible.
+For example, for methods returning multiple entities you may choose `Iterable`, `List`, `Collection` or a VAVR list.
+
+If many repositories in your application should have the same set of methods you can define your own base interface to inherit from.
+Such an interface must be annotated with `@NoRepositoryBean`.
+This prevents Spring Data to try to create an instance of it directly and failing because it can't determine the entity for that repository, since it still contains a generic type variable.
The following example shows how to selectively expose CRUD methods (`findById` and `save`, in this case):
diff --git a/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java b/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java
index 8f557d4a07..2b07b3c6b6 100644
--- a/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java
+++ b/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java
@@ -20,16 +20,19 @@
import org.springframework.data.domain.Sort;
/**
- * Extension of {@link CrudRepository} to provide additional methods to retrieve entities using the pagination and
- * sorting abstraction.
+ * Repository fragment to provide methods to retrieve entities using the pagination and sorting abstraction. In many
+ * cases this will be combined with {@link CrudRepository} or similar or with manually added methods to provide CRUD
+ * functionality.
*
* @author Oliver Gierke
+ * @author Jens Schauder
* @see Sort
* @see Pageable
* @see Page
+ * @see CrudRepository
*/
@NoRepositoryBean
-public interface PagingAndSortingRepository extends CrudRepository {
+public interface PagingAndSortingRepository extends Repository {
/**
* Returns all entities sorted by the given options.
diff --git a/src/main/java/org/springframework/data/repository/reactive/ReactiveSortingRepository.java b/src/main/java/org/springframework/data/repository/reactive/ReactiveSortingRepository.java
index 38e316d426..7ec08e63ae 100644
--- a/src/main/java/org/springframework/data/repository/reactive/ReactiveSortingRepository.java
+++ b/src/main/java/org/springframework/data/repository/reactive/ReactiveSortingRepository.java
@@ -20,20 +20,24 @@
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;
+import org.springframework.data.repository.Repository;
/**
- * Extension of {@link ReactiveCrudRepository} to provide additional methods to retrieve entities using the sorting
- * abstraction.
+ * Repository fragment to provide methods to retrieve entities using the sorting abstraction. In many cases it
+ * should be combined with {@link ReactiveCrudRepository} or a similar repository interface in order to add CRUD
+ * functionality.
*
* @author Mark Paluch
* @author Christoph Strobl
+ * @author Jens Schauder
* @since 2.0
* @see Sort
* @see Mono
* @see Flux
+ * @see ReactiveCrudRepository
*/
@NoRepositoryBean
-public interface ReactiveSortingRepository extends ReactiveCrudRepository {
+public interface ReactiveSortingRepository extends Repository {
/**
* Returns all entities sorted by the given options.
diff --git a/src/main/java/org/springframework/data/repository/reactive/RxJava3SortingRepository.java b/src/main/java/org/springframework/data/repository/reactive/RxJava3SortingRepository.java
index d2f069c67b..bae5dbd1c7 100644
--- a/src/main/java/org/springframework/data/repository/reactive/RxJava3SortingRepository.java
+++ b/src/main/java/org/springframework/data/repository/reactive/RxJava3SortingRepository.java
@@ -19,18 +19,21 @@
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.NoRepositoryBean;
+import org.springframework.data.repository.Repository;
/**
- * Extension of {@link RxJava3CrudRepository} to provide additional methods to retrieve entities using the sorting
- * abstraction.
- *
+ * Repository fragment to provide methods to retrieve entities using the sorting abstraction. In many cases this
+ * should be combined with {@link RxJava3CrudRepository} or a similar interface to provide CRUD functionality.
+ *
* @author Mark Paluch
+ * @author Jens Schauder
* @since 2.4
* @see Sort
* @see Flowable
+ * @see RxJava3CrudRepository
*/
@NoRepositoryBean
-public interface RxJava3SortingRepository extends RxJava3CrudRepository {
+public interface RxJava3SortingRepository extends Repository {
/**
* Returns all entities sorted by the given options.
diff --git a/src/main/java/org/springframework/data/repository/support/DefaultRepositoryInvokerFactory.java b/src/main/java/org/springframework/data/repository/support/DefaultRepositoryInvokerFactory.java
index bdd9195e52..c27e785d48 100644
--- a/src/main/java/org/springframework/data/repository/support/DefaultRepositoryInvokerFactory.java
+++ b/src/main/java/org/springframework/data/repository/support/DefaultRepositoryInvokerFactory.java
@@ -35,6 +35,7 @@
*
* @author Oliver Gierke
* @author Christoph Strobl
+ * @author Jens Schauder
* @since 1.10
*/
public class DefaultRepositoryInvokerFactory implements RepositoryInvokerFactory {
@@ -93,7 +94,7 @@ private RepositoryInvoker prepareInvokers(Class> domainType) {
@SuppressWarnings("unchecked")
protected RepositoryInvoker createInvoker(RepositoryInformation information, Object repository) {
- if (repository instanceof PagingAndSortingRepository) {
+ if (repository instanceof PagingAndSortingRepository && repository instanceof CrudRepository) {
return new PagingAndSortingRepositoryInvoker((PagingAndSortingRepository