title: Usage of UserCredentials with MongoClient is no longer supported
body: <p>I am trying to deploy my spring boot app to cloud foundry. However I am receiving the below error.</p>
  
  <pre><code>2016-02-19T16:54:29.57+0000 [App/0]      ERR Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Usage of 'UserCredentials' with 'MongoClient' is no longer supported. Please use 'MongoCredential' for 'MongoClient' or just 'Mongo'.
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.springframework.data.mongodb.core.SimpleMongoDbFactory.&lt;init&gt;(SimpleMongoDbFactory.java:137)
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.springframework.data.mongodb.core.SimpleMongoDbFactory.&lt;init&gt;(SimpleMongoDbFactory.java:78)
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.cloudfoundry.reconfiguration.org.springframework.cloud.service.document.MongoDbFactoryCreator.create(MongoDbFactoryCreator.java:46)
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.cloudfoundry.reconfiguration.org.springframework.cloud.service.document.MongoDbFactoryCreator.create(MongoDbFactoryCreator.java:35)
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.cloudfoundry.reconfiguration.org.springframework.cloud.Cloud.getServiceConnector(Cloud.java:257)
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.cloudfoundry.reconfiguration.org.springframework.cloud.Cloud.getSingletonServiceConnector(Cloud.java:167)
  2016-02-19T16:54:29.57+0000 [App/0]      ERR    at org.cloudfoundry.reconfiguration.spring.AbstractCloudServiceBeanFactoryPostProcessor.reconfigureBean(AbstractCloudServiceBeanFactoryPostProcessor.java:119)
  </code></pre>
  
  <p>It was my understanding the Spring Boot will automatically find the bound Mongo service and all the necessary user credentials and URI details, meaning I don't need to explicitly declare these variables.</p>
  
  <p>Does anyone know why I am receiving this error and how I can solve it?</p>
  
  <p>Here is my Java code snippet:</p>
  
  <pre><code>@Autowired
      public MongoRepository(MongoClient mongo) {
          this.mongo = mongo;
      }
  
  
  public long insert(Document document){
  
      MongoDatabase db = mongo.getDatabase("test");
      MongoCollection&lt;Document&gt; coll = db.getCollection("document");
      coll.insertOne(document);
  }
  </code></pre>
  
  <p>I am using Mongo3.0 java driver.</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
      &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
      &lt;version&gt;3.0.0&lt;/version&gt;&lt;!--$NO-MVN-MAN-VER$--&gt;
  &lt;/dependency&gt;
  </code></pre>