diff --git a/README.md b/README.md index f5964e0..73f9802 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# Spring Cloud [![Build Status](https://build.spring.io/plugins/servlet/buildStatusImage/CLOUD-NIGHTLY "Optional title")](https://build.spring.io/browse/CLOUD-NIGHTLY) +# Spring Cloud Connectors [![Build Status](https://build.spring.io/plugins/servlet/buildStatusImage/CLOUD-NIGHTLY "Optional title")](https://build.spring.io/browse/CLOUD-NIGHTLY) -Spring Cloud provides a simple abstraction for JVM-based applications running on cloud platforms +Spring Cloud Connectors provides a simple abstraction for JVM-based applications running on cloud platforms to discover bound services and deployment information at runtime and provides support for registering discovered services as Spring beans. It is based on a plugin model so that the identical compiled application can be deployed locally or on multiple clouds, and it supports custom service definitions through Java SPI. -Spring Cloud provides out-of-the-box support for discovering common services on Heroku and +Spring Cloud Connectors provides out-of-the-box support for discovering common services on Heroku and Cloud Foundry clouds as well as a properties-based configuration for development and testing. The core concepts used in this project are: @@ -51,7 +51,7 @@ connectors is perfectly fine; each connector will determine whether it should be particular environment. ````xml - + org.springframework.cloud spring-cloud-localconfig-connector @@ -115,5 +115,5 @@ the `` namespace](spring-cloud-spring-service-connector). The [`spring-cloud-core`](core) dependency is included by each cloud connector, so simply include the connectors for the platforms you want. -Then follow the [instructions](spring-cloud-core) on using the Spring Cloud API. +Then follow the [instructions](spring-cloud-core) on using the Spring Cloud Connectors API. diff --git a/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/document/MongoDbFactoryCreator.java b/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/document/MongoDbFactoryCreator.java index 850a13c..09a6721 100644 --- a/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/document/MongoDbFactoryCreator.java +++ b/spring-cloud-spring-service-connector/src/main/java/org/springframework/cloud/service/document/MongoDbFactoryCreator.java @@ -42,8 +42,14 @@ public class MongoDbFactoryCreator extends AbstractServiceConnectorCreator serverAddressList = getServerAddresses(mongoClientURI); MongoClient mongo = new MongoClient(serverAddressList, mongoOptionsToUse); - UserCredentials credentials = new UserCredentials(mongoClientURI.getUsername(), new String(mongoClientURI.getPassword())); - SimpleMongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(mongo, mongoClientURI.getDatabase(), credentials); + + SimpleMongoDbFactory mongoDbFactory; + if (mongoClientURI.getUsername() != null && mongoClientURI.getPassword() != null) { + UserCredentials credentials = new UserCredentials(mongoClientURI.getUsername(), new String(mongoClientURI.getPassword())); + mongoDbFactory = new SimpleMongoDbFactory(mongo, mongoClientURI.getDatabase(), credentials); + } else { + mongoDbFactory = new SimpleMongoDbFactory(mongo, mongoClientURI.getDatabase()); + } return configure(mongoDbFactory, (MongoDbFactoryConfig) config); } catch (UnknownHostException e) {