title: Spring boot with spring.data.mongodb.uri=mongodb://otherhost/test
body: <p>I developed a Spring boot application with MongoDB. While the MongoDB in the localhost, it works fine, but when the MongoDB is in different the server, I changed the setting in application.properties as</p>
  
  <pre><code>spring.data.mongodb.uri=mongodb://192.168.7.31/gcp
  spring.data.mongodb.username=xxx
  spring.data.mongodb.password=xxxxxxx
  </code></pre>
  
  <p>the application faileds as it still looks for the mongoDB in localhost</p>
  
  <pre><code>2017-01-04 11:47:46.161  INFO 15610 --- [           main] org.mongodb.driver.cluster               : Adding discovered server localhost:27017 to client view of cluster
  2017-01-04 11:47:46.218  INFO 15610 --- [localhost:27017] org.mongodb.driver.cluster               : Exception in monitor thread while connecting to server localhost:27017
  com.mongodb.MongoSocketOpenException: Exception opening socket
  at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.2.2.jar:na]
  at  com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) ~[mongodb-driver-core-3.2.2.jar:na]
  at com.mongodb.connection.DefaultServerMonitor$ServerMonitorR
  </code></pre>
  
  <p>Anyone can help to tell me how to set the parameters?</p>