updates to get s-c-consul working again

This commit is contained in:
Spencer Gibb
2014-12-09 20:21:09 -07:00
parent 4e7d380435
commit 54f8a56f72
4 changed files with 14 additions and 10 deletions

View File

@@ -1,9 +1,12 @@
package org.springframework.cloud.consul.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.config.client.ConfigClientProperties;
import org.springframework.cloud.consul.ConsulAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.env.ConfigurableEnvironment;
/**
* @author Spencer Gibb
@@ -11,6 +14,16 @@ import org.springframework.context.annotation.Import;
@Configuration
@Import(ConsulAutoConfiguration.class)
public class ConsulConfigBootstrapConfiguration {
@Autowired
private ConfigurableEnvironment environment;
@Bean
public ConfigClientProperties configClientProperties() {
ConfigClientProperties client = new ConfigClientProperties(environment);
return client;
}
@Bean
public ConsulPropertySourceLocator consulPropertySourceLocator() {
return new ConsulPropertySourceLocator();

View File

@@ -64,6 +64,7 @@ public class ConsulLoadBalancerClient implements LoadBalancerClient {
@Override
public URI reconstructURI(ServiceInstance instance, URI original) {
//TODO: move this pattern to a helper method
URI uri = UriComponentsBuilder.fromUri(original)
.host(instance.getHost())
.port(instance.getPort())

View File

@@ -33,11 +33,6 @@
<artifactId>spring-boot-starter-web</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-consul-config</artifactId>

View File

@@ -6,11 +6,6 @@ spring:
application:
name: testConsulApp
security:
user:
name: user
password: password
endpoints:
health:
sensitive: false