I've got mongo DB running on docker. To set username and password I set MONGO_INITDB_DATABASE, MONGO_INITDB_ROOT_USERNAME and MONGO_INITDB_ROOT_PASSWORD variables.
And now on spring boot application a can use URI:
mongodb://username:password@host:27017/db_name?authSource=admin
and it's working.
Now I want changed properties and it looks like:
spring:
data:
mongodb:
authentication-database: admin
host: host
database: db_name
password: password
port: 27107
username: username
Any ideas what is wrong?
springboot: 2.2.5 spring-boot-starter-data-mongodb-reactive
I found that on the documentation:
If you use the Mongo 3.0 Java driver,
spring.data.mongodb.host
andspring.data.mongodb.port
are not supported. In such cases,spring.data.mongodb.uri
should be used to provide all of the configuration.
So probably this is the problem and for now I just stay with the URI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With