diff --git a/pom.xml b/pom.xml index 2788cac..42e435c 100644 --- a/pom.xml +++ b/pom.xml @@ -63,6 +63,21 @@ spring-platform-config-client 1.0.0.BUILD-SNAPSHOT + + org.springframework.cloud + spring-cloud-spring-service-connector + 1.1.0.BUILD-SNAPSHOT + + + org.springframework.cloud + spring-cloud-localconfig-connector + 1.1.0.BUILD-SNAPSHOT + + + org.springframework.cloud + spring-cloud-cloudfoundry-connector + 1.1.0.BUILD-SNAPSHOT + org.projectlombok lombok diff --git a/src/main/java/org/springframework/cloud/notcfconfig/NotCFConfigConnector.java b/src/main/java/org/springframework/cloud/notcfconfig/NotCFConfigConnector.java new file mode 100644 index 0000000..bd0ba15 --- /dev/null +++ b/src/main/java/org/springframework/cloud/notcfconfig/NotCFConfigConnector.java @@ -0,0 +1,28 @@ +package org.springframework.cloud.notcfconfig; + +import org.springframework.cloud.localconfig.LocalConfigConnector; +import org.springframework.cloud.service.UriBasedServiceData; +import org.springframework.cloud.util.EnvironmentAccessor; + +import java.util.Collections; +import java.util.List; + +/** + * @author Spencer Gibb + * Let's spring boots current auto-configuration work, effectivly disabling spring cloud local + * TODO: workaround for not having to configure the local cloud connector + */ +public class NotCFConfigConnector extends LocalConfigConnector { + + private EnvironmentAccessor env = new EnvironmentAccessor(); + + @Override + public boolean isInMatchingCloud() { + return env.getEnvValue("VCAP_APPLICATION") == null; + } + + @Override + protected List getServicesData() { + return Collections.emptyList(); + } +} diff --git a/src/main/resources/META-INF/services/org.springframework.cloud.CloudConnector b/src/main/resources/META-INF/services/org.springframework.cloud.CloudConnector new file mode 100644 index 0000000..440a3f3 --- /dev/null +++ b/src/main/resources/META-INF/services/org.springframework.cloud.CloudConnector @@ -0,0 +1 @@ +org.springframework.cloud.notcfconfig.NotCFConfigConnector \ No newline at end of file diff --git a/src/main/resources/META-INF/services/org.springframework.cloud.notcfconfig.NotCFConfigConnector b/src/main/resources/META-INF/services/org.springframework.cloud.notcfconfig.NotCFConfigConnector new file mode 100644 index 0000000..f8a14d4 --- /dev/null +++ b/src/main/resources/META-INF/services/org.springframework.cloud.notcfconfig.NotCFConfigConnector @@ -0,0 +1,5 @@ +org.springframework.cloud.localconfig.AmqpServiceInfoCreator +org.springframework.cloud.localconfig.MongoServiceInfoCreator +org.springframework.cloud.localconfig.MysqlServiceInfoCreator +org.springframework.cloud.localconfig.PostgresqlServiceInfoCreator +org.springframework.cloud.localconfig.RedisServiceInfoCreator \ No newline at end of file