Commit f0bcba5f authored by Alex Segers's avatar Alex Segers

FIX: 🔧 Provide URI to MongoDb configuration file [@asegers]

parent 8e280738
......@@ -10,13 +10,16 @@ import org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory;
@Configuration
public class MongoConfig {
@Value("${spring.data.mongodb.database}")
public String databaseName;
@Value("${spring.data.mongodb.database:myFirstDatabase}")
public String database;
@Value("${spring.data.mongodb.uri:mongodb+srv://user:password2021@cluster0.g23rm.mongodb.net/myFirstDatabase?}")
public String uri;
@Bean
public SimpleReactiveMongoDatabaseFactory reactiveMongoDbFactory() {
MongoClient mongoClient = MongoClients.create();
return new SimpleReactiveMongoDatabaseFactory(mongoClient, databaseName);
MongoClient mongoClient = MongoClients.create(uri);
return new SimpleReactiveMongoDatabaseFactory(mongoClient, database);
}
@Bean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment