Skip to content

A sample Spring Boot 2.1.3 app which uses a custom configuration for reactive mongodb repository

Notifications You must be signed in to change notification settings

lradziwonowicz/spring-boot-mongodb-reactive-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-mongodb-reactive-config

A sample Spring Boot 2.1.3 app which uses a custom configuration for reactive mongodb repository.

Exclude mongo configuration (the blocking one and part of reactive):

@SpringBootApplication(
    exclude = {MongoAutoConfiguration.class, MongoReactiveDataAutoConfiguration.class})

Create your own implementation of AbstractReactiveMongoConfiguration and annotate reactiveMongoClient() with a @Bean:

@Configuration
public class CustomerMongoConfig extends AbstractReactiveMongoConfiguration {

  @Autowired private CustomerProperties properties;

  @Override
  @Bean
  public MongoClient reactiveMongoClient() {
    return MongoClients.create(properties.getMongoUri());
  }

  @Override
  protected String getDatabaseName() {
    return properties.getDatabase();
  }
}

About

A sample Spring Boot 2.1.3 app which uses a custom configuration for reactive mongodb repository

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages