Skip to content

Commit 35f43e9

Browse files
committed
DATAMONGO-1566 - Adapt API in ReactiveMongoRepositoryFactoryBean.
Related tickets: DATACMNS-891.
1 parent a77c5b6 commit 35f43e9

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/ReactiveMongoRepositoryFactoryBean.java

+13-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
* @author Mark Paluch
3434
* @author Christoph Strobl
3535
* @since 2.0
36-
* @see org.springframework.data.repository.reactive.ReactivePagingAndSortingRepository
37-
* @see org.springframework.data.repository.reactive.RxJavaPagingAndSortingRepository
36+
* @see org.springframework.data.repository.reactive.ReactiveSortingRepository
37+
* @see org.springframework.data.repository.reactive.RxJava1SortingRepository
3838
*/
3939
public class ReactiveMongoRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable>
4040
extends RepositoryFactoryBeanSupport<T, S, ID> {
@@ -43,6 +43,15 @@ public class ReactiveMongoRepositoryFactoryBean<T extends Repository<S, ID>, S,
4343
private boolean createIndexesForQueryMethods = false;
4444
private boolean mappingContextConfigured = false;
4545

46+
/**
47+
* Creates a new {@link ReactiveMongoRepositoryFactoryBean} for the given repository interface.
48+
*
49+
* @param repositoryInterface must not be {@literal null}.
50+
*/
51+
public ReactiveMongoRepositoryFactoryBean(Class<? extends T> repositoryInterface) {
52+
super(repositoryInterface);
53+
}
54+
4655
/**
4756
* Configures the {@link ReactiveMongoOperations} to be used.
4857
*
@@ -85,8 +94,8 @@ protected final RepositoryFactorySupport createRepositoryFactory() {
8594
RepositoryFactorySupport factory = getFactoryInstance(operations);
8695

8796
if (createIndexesForQueryMethods) {
88-
factory.addQueryCreationListener(
89-
new IndexEnsuringQueryCreationListener(collectionName -> IndexOperationsAdapter.blocking(operations.indexOps(collectionName))));
97+
factory.addQueryCreationListener(new IndexEnsuringQueryCreationListener(
98+
collectionName -> IndexOperationsAdapter.blocking(operations.indexOps(collectionName))));
9099
}
91100

92101
return factory;

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/config/ReactiveMongoRepositoriesRegistrarIntegrationTests.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,14 @@
1616

1717
package org.springframework.data.mongodb.repository.config;
1818

19-
import static org.hamcrest.CoreMatchers.*;
20-
import static org.junit.Assert.*;
21-
22-
import java.util.Arrays;
23-
2419
import org.junit.Test;
2520
import org.junit.runner.RunWith;
2621
import org.springframework.beans.factory.annotation.Autowired;
2722
import org.springframework.context.ApplicationContext;
2823
import org.springframework.context.annotation.Bean;
2924
import org.springframework.context.annotation.Configuration;
30-
import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
3125
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
26+
import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
3227
import org.springframework.data.mongodb.repository.ReactivePersonRepository;
3328
import org.springframework.test.context.ContextConfiguration;
3429
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -62,15 +57,4 @@ public ReactiveMongoTemplate reactiveMongoTemplate() throws Exception {
6257
*/
6358
@Test
6459
public void testConfiguration() {}
65-
66-
/**
67-
* @see DATAMONGO-1444
68-
*/
69-
@Test
70-
public void registersTypePredictingPostProcessor() {
71-
72-
Iterable<String> beanNames = Arrays.asList(context.getBeanDefinitionNames());
73-
74-
assertThat(beanNames, hasItem(containsString("RepositoryFactoryBeanSupport_Predictor")));
75-
}
7660
}

0 commit comments

Comments
 (0)