diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java index 808020bed..7bf621b56 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 the original author or authors. + * Copyright 2010-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,9 @@ import java.util.List; import org.springframework.data.domain.Example; import org.springframework.data.domain.Sort; +import org.springframework.data.repository.ListCrudRepository; +import org.springframework.data.repository.ListPagingAndSortingRepository; import org.springframework.data.repository.NoRepositoryBean; -import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.QueryByExampleExecutor; /** @@ -33,16 +34,8 @@ import org.springframework.data.repository.query.QueryByExampleExecutor; * @author Khaled Baklouti */ @NoRepositoryBean -public interface MongoRepository extends PagingAndSortingRepository, QueryByExampleExecutor { - - @Override - List saveAll(Iterable entities); - - @Override - List findAll(); - - @Override - List findAll(Sort sort); +public interface MongoRepository + extends ListCrudRepository, ListPagingAndSortingRepository, QueryByExampleExecutor { /** * Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ReactiveMongoRepository.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ReactiveMongoRepository.java index a9c62a50a..5603f598c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ReactiveMongoRepository.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ReactiveMongoRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import org.springframework.data.domain.Example; import org.springframework.data.domain.Sort; import org.springframework.data.repository.NoRepositoryBean; import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor; +import org.springframework.data.repository.reactive.ReactiveCrudRepository; import org.springframework.data.repository.reactive.ReactiveSortingRepository; /** @@ -32,7 +33,8 @@ import org.springframework.data.repository.reactive.ReactiveSortingRepository; * @since 2.0 */ @NoRepositoryBean -public interface ReactiveMongoRepository extends ReactiveSortingRepository, ReactiveQueryByExampleExecutor { +public interface ReactiveMongoRepository + extends ReactiveCrudRepository, ReactiveSortingRepository, ReactiveQueryByExampleExecutor { /** * Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java index 5f4488dbc..f16c9a38e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java @@ -135,7 +135,7 @@ public class SimpleMongoRepository implements MongoRepository { } @Override - public Iterable findAllById(Iterable ids) { + public List findAllById(Iterable ids) { Assert.notNull(ids, "The given Ids of entities not be null!"); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ConvertingReactiveMongoRepositoryTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ConvertingReactiveMongoRepositoryTests.java index f18bcbbab..55651839f 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ConvertingReactiveMongoRepositoryTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/ConvertingReactiveMongoRepositoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2021 the original author or authors. + * Copyright 2016-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,9 @@ import io.reactivex.rxjava3.core.Single; import io.reactivex.rxjava3.subscribers.TestSubscriber; import lombok.Data; import lombok.NoArgsConstructor; + +import org.springframework.data.repository.reactive.ReactiveCrudRepository; +import org.springframework.data.repository.reactive.RxJava3CrudRepository; import org.springframework.data.repository.reactive.RxJava3SortingRepository; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -222,12 +225,14 @@ public class ConvertingReactiveMongoRepositoryTests { // assertThat(people).contains(carter, dave); // } - interface ReactivePersonRepostitory extends ReactiveSortingRepository { +interface ReactivePersonRepostitory + extends ReactiveCrudRepository, ReactiveSortingRepository { Publisher findByLastname(String lastname); } - interface RxJava3PersonRepostitory extends RxJava3SortingRepository { + interface RxJava3PersonRepostitory + extends RxJava3CrudRepository, RxJava3SortingRepository { io.reactivex.rxjava3.core.Flowable findByFirstnameAndLastname(String firstname, String lastname);