Closed dsyer closed 9 years ago
As far as I can tell, the correct way to do it now is to just use the URI as it is and not try to extract credentials from it. So Spring Boot out of the box works fine and they changed the MongoDataAutoConfiguration
to just do this:
@Bean
@ConditionalOnMissingBean(MongoDbFactory.class)
public SimpleMongoDbFactory mongoDbFactory(MongoClient mongo) throws Exception {
String database = this.properties.getMongoClientDatabase();
return new SimpleMongoDbFactory(mongo, database);
}
i.e. no messing around with the URI to extract credentials.
The latest version of Spring Data Mongo (and hence Spring Boot 1.3) breaks with spring-cloud-connectors because of the way the
SimpleMongoDbFactory
is created: