Commit 1f63ea91 by Dave Syer

Update build and fix race in eureka

parent c8be52b0
......@@ -27,6 +27,9 @@ import org.springframework.context.ApplicationListener;
import org.springframework.context.SmartLifecycle;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.Ordered;
......@@ -109,6 +112,8 @@ public class EurekaClientConfiguration implements
}
@Bean
@Lazy
@Scope(proxyMode=ScopedProxyMode.TARGET_CLASS)
public DiscoveryClient discoveryClient() {
return DiscoveryManager.getInstance().getDiscoveryClient();
}
......
......@@ -66,7 +66,7 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
private int leaseExpirationDurationInSeconds = 90;
@Value("${spring.application.name:unknown}") //TODO: why is .mydomain.net here?
@Value("${spring.application.name:unknown}")
private String virtualHostName;
private String secureVirtualHostName;
......@@ -99,6 +99,12 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
private String namespace = "eureka";
private String hostname = hostInfo[1];
private boolean preferIpAddress = false;
public String getHostname() {
return preferIpAddress ? ipAddress : hostname;
}
@Override
public boolean getSecurePortEnabled() {
......@@ -118,7 +124,7 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
@Override
public String getHostName(boolean refresh) {
return hostname;
return preferIpAddress ? ipAddress : hostname;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment