title: Error connect remote MongoDB Exception in monitor thread while connecting to server localhost:27017
body: <p>I'm trying to connect to the remote atlas bank, however it looks like I'm being redirected to localhost. I configured spring.data.mongodb.uri as usual, that same project was working a few days ago and other projects with the same structure are working normally. With the same connection uri, I can connect via the mongoDB client.
  I'm using spring boot 2.6, below is the dependencies used via gradle</p>
  <pre><code>    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
      compile group: 'net.sourceforge.htmlunit', name: 'htmlunit', version: '2.39.1'
      compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.17'
      compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '2.1.3.RELEASE'
      compile group: 'io.github.openfeign.form', name: 'feign-form', version: '3.8.0'
      compile group: 'io.github.openfeign', name: 'feign-jaxb', version: '10.7.4'
      compile ('io.springfox:springfox-swagger2:2.8.0')
      compile ('io.springfox:springfox-swagger-ui:2.8.0')
      compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
      compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.1'
      compile group: 'com.github.mpkorstanje', name: 'simmetrics-core', version: '4.1.1'
      compile group: 'org.apache.poi', name: 'poi', version: '4.1.1'
      compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.1'
      compile group: 'org.apache.poi', name: 'poi-scratchpad', version: '4.1.1'
      compile group: 'org.apache.tika', name: 'tika-parsers', version: '1.23'
      compile group: 'org.apache.tika', name: 'tika-core', version: '1.23'
      implementation 'org.springframework.boot:spring-boot-starter-web'
      implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
      testCompile group: 'com.google.caliper', name: 'caliper', version: '0.5-rc1'
  
      testImplementation('org.springframework.boot:spring-boot-starter-test') {
          exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
      }
  }```
  
  This log error: &quot;Exception in monitor thread while connecting to server localhost:27017&quot;
  
  I saw some comments telling me to disable @EnableAutoConfiguration (exclude = {MongoAutoConfiguration.class}), however, it didn't work, after all I'm trying to connect to a remote mongo and don't disable it.
  
  It seems to me something related to the configuration of routes / dns something like that, I don't know, I'm confused about that. Would any good soul know how to help me?
  </code></pre>