Last active
December 9, 2017 05:13
-
-
Save shazin/2d59f71beb0c413708c49d1440da0c36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication(exclude = {MongoAutoConfiguration.class, | |
MongoDataAutoConfiguration.class }) | |
@EnableReactiveMongoRepositories | |
@AutoConfigureAfter(EmbeddedMongoAutoConfiguration.class) | |
public class ApplicationConfiguration | |
extends AbstractReactiveMongoConfiguration { | |
private final Environment environment; | |
public ApplicationConfiguration(Environment environment) { | |
this.environment = environment; | |
} | |
@Bean | |
public LoggingEventListener mongoEventListener() { | |
return new LoggingEventListener(); | |
} | |
@Override | |
@Bean | |
@DependsOn("embeddedMongoServer") | |
public MongoClient reactiveMongoClient() { | |
int port = environment.getProperty("local.mongo.port", Integer.class); | |
return MongoClients.create(String.format("mongodb://localhost:%d", port)); | |
} | |
@Override | |
protected String getDatabaseName() { | |
return "reactive"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment