I am having problems in using Spring to access MongoDB with credentials. While without credentials it works like a charme, using them just fails saying
F
spring.data.mongodb.host and spring.data.mongodb.port are not supported if you’re using the Mongo 3.0 Java driver. In such cases, spring.data.mongodb.uri should be used to provide all of the configuration, like this:
spring.data.mongodb.uri=mongodb://user:secret@mongo1.example.com:12345
Just add the spring.data.mongodb.uri to your application.yml and you'll get the auto configured MongoDbFactory and MongoTemplate.