More detail on credentials for discovery

This commit is contained in:
Dave Syer
2016-04-29 13:49:13 +01:00
parent 538ceeee7a
commit 660dabdf9c
4 changed files with 11 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
/**
* @author Josh Long
@@ -54,7 +55,7 @@ public class CloudFoundryDiscoveryClientConfiguration {
public CloudFoundryClient cloudFoundryClient(CloudCredentials cc)
throws MalformedURLException {
CloudFoundryClient cloudFoundryClient;
if (this.discovery.getOrg() != null && this.discovery.getSpace() != null) {
if (StringUtils.hasText(this.discovery.getOrg()) && StringUtils.hasText(this.discovery.getSpace())) {
cloudFoundryClient = new CloudFoundryClient(cc,
URI.create(this.discovery.getUrl()).toURL(), this.discovery.getOrg(),
this.discovery.getSpace());

View File

@@ -16,6 +16,7 @@
package org.springframework.cloud.cloudfoundry.discovery;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -47,6 +48,7 @@ public class CloudFoundryDiscoveryProperties {
/**
* Space name to authenticate with (default to user's default).
*/
@Value("${vcap.application.space_name:}")
private String space;
/**