diff --git a/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java b/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java index b907eb9c0..4602ef22c 100644 --- a/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java +++ b/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java @@ -73,11 +73,11 @@ public interface ReactiveCrudRepository extends Repository { /** * Retrieves an entity by its id supplied by a {@link Mono}. * - * @param id must not be {@literal null}. + * @param id must not be {@literal null}. Uses the first emitted element to perform the find-query. * @return the entity with the given id or {@link Mono#empty()} if none found. * @throws IllegalArgumentException if {@code id} is {@literal null}. */ - Mono findById(Mono id); + Mono findById(Publisher id); /** * Returns whether an entity with the given id exists. @@ -89,13 +89,14 @@ public interface ReactiveCrudRepository extends Repository { Mono existsById(ID id); /** - * Returns whether an entity with the given id, supplied by a {@link Mono}, exists. + * Returns whether an entity with the given id, supplied by a {@link Mono}, exists. Uses the first emitted element to + * perform the exists-query. * * @param id must not be {@literal null}. * @return {@literal true} if an entity with the given id exists, {@literal false} otherwise * @throws IllegalArgumentException if {@code id} is {@literal null} */ - Mono existsById(Mono id); + Mono existsById(Publisher id); /** * Returns all instances of the type. diff --git a/src/test/java/org/springframework/data/repository/core/support/ReactiveWrapperRepositoryFactorySupportUnitTests.java b/src/test/java/org/springframework/data/repository/core/support/ReactiveWrapperRepositoryFactorySupportUnitTests.java index 710f2c94d..3c4e59855 100644 --- a/src/test/java/org/springframework/data/repository/core/support/ReactiveWrapperRepositoryFactorySupportUnitTests.java +++ b/src/test/java/org/springframework/data/repository/core/support/ReactiveWrapperRepositoryFactorySupportUnitTests.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.*; import io.reactivex.Completable; import io.reactivex.Maybe; +import org.reactivestreams.Publisher; import reactor.core.publisher.Mono; import rx.Single; @@ -37,7 +38,7 @@ import org.springframework.data.repository.reactive.ReactiveSortingRepository; /** * Unit tests for {@link RepositoryFactorySupport} using reactive wrapper types. - * + * * @author Mark Paluch * @author Christoph Strobl */ @@ -77,7 +78,7 @@ public class ReactiveWrapperRepositoryFactorySupportUnitTests { verify(backingRepo, times(2)).existsById(id); } - @Test // DATACMNS-836 + @Test // DATACMNS-836, DATACMNS-1063 @SuppressWarnings("unchecked") public void callsRxJava1MethodOnBaseImplementationWithTypeConversion() { @@ -86,7 +87,7 @@ public class ReactiveWrapperRepositoryFactorySupportUnitTests { RxJava1ConvertingRepository repository = factory.getRepository(RxJava1ConvertingRepository.class); repository.existsById(ids); - verify(backingRepo, times(1)).existsById(any(Mono.class)); + verify(backingRepo, times(1)).existsById(any(Publisher.class)); } @Test // DATACMNS-988