DATAMONGO-1566 - Adapt API in ReactiveMongoRepositoryFactoryBean.
Related tickets: DATACMNS-891.
This commit is contained in:
@@ -33,8 +33,8 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @since 2.0
|
||||
* @see org.springframework.data.repository.reactive.ReactivePagingAndSortingRepository
|
||||
* @see org.springframework.data.repository.reactive.RxJavaPagingAndSortingRepository
|
||||
* @see org.springframework.data.repository.reactive.ReactiveSortingRepository
|
||||
* @see org.springframework.data.repository.reactive.RxJava1SortingRepository
|
||||
*/
|
||||
public class ReactiveMongoRepositoryFactoryBean<T extends Repository<S, ID>, S, ID extends Serializable>
|
||||
extends RepositoryFactoryBeanSupport<T, S, ID> {
|
||||
@@ -43,6 +43,15 @@ public class ReactiveMongoRepositoryFactoryBean<T extends Repository<S, ID>, S,
|
||||
private boolean createIndexesForQueryMethods = false;
|
||||
private boolean mappingContextConfigured = false;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ReactiveMongoRepositoryFactoryBean} for the given repository interface.
|
||||
*
|
||||
* @param repositoryInterface must not be {@literal null}.
|
||||
*/
|
||||
public ReactiveMongoRepositoryFactoryBean(Class<? extends T> repositoryInterface) {
|
||||
super(repositoryInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the {@link ReactiveMongoOperations} to be used.
|
||||
*
|
||||
@@ -85,8 +94,8 @@ public class ReactiveMongoRepositoryFactoryBean<T extends Repository<S, ID>, S,
|
||||
RepositoryFactorySupport factory = getFactoryInstance(operations);
|
||||
|
||||
if (createIndexesForQueryMethods) {
|
||||
factory.addQueryCreationListener(
|
||||
new IndexEnsuringQueryCreationListener(collectionName -> IndexOperationsAdapter.blocking(operations.indexOps(collectionName))));
|
||||
factory.addQueryCreationListener(new IndexEnsuringQueryCreationListener(
|
||||
collectionName -> IndexOperationsAdapter.blocking(operations.indexOps(collectionName))));
|
||||
}
|
||||
|
||||
return factory;
|
||||
|
||||
@@ -16,19 +16,14 @@
|
||||
|
||||
package org.springframework.data.mongodb.repository.config;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
|
||||
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
|
||||
import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
|
||||
import org.springframework.data.mongodb.repository.ReactivePersonRepository;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -62,15 +57,4 @@ public class ReactiveMongoRepositoriesRegistrarIntegrationTests {
|
||||
*/
|
||||
@Test
|
||||
public void testConfiguration() {}
|
||||
|
||||
/**
|
||||
* @see DATAMONGO-1444
|
||||
*/
|
||||
@Test
|
||||
public void registersTypePredictingPostProcessor() {
|
||||
|
||||
Iterable<String> beanNames = Arrays.asList(context.getBeanDefinitionNames());
|
||||
|
||||
assertThat(beanNames, hasItem(containsString("RepositoryFactoryBeanSupport_Predictor")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user