title: Spring connect to mongodb using username and password
body: <p>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.</p>
  
  <p>And now on spring boot application a can use URI: 
  <code>mongodb://username:password@host:27017/db_name?authSource=admin</code> and it's working.</p>
  
  <p>Now I want changed properties and it looks like:</p>
  
  <pre><code>spring:
    data:
      mongodb:
        authentication-database: admin
        host: host
        database: db_name
        password: password
        port: 27107
        username: username
  </code></pre>
  
  <p>Any ideas what is wrong?</p>
  
  <p>springboot: 2.2.5
  spring-boot-starter-data-mongodb-reactive</p>