Browse Source

Update build and fix race in eureka

pull/6/head
Dave Syer 10 years ago
parent
commit
1f63ea919c
  1. 5
      spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaClientConfiguration.java
  2. 10
      spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaInstanceConfigBean.java

5
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaClientConfiguration.java

@ -27,6 +27,9 @@ import org.springframework.context.ApplicationListener; @@ -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 @@ -109,6 +112,8 @@ public class EurekaClientConfiguration implements
}
@Bean
@Lazy
@Scope(proxyMode=ScopedProxyMode.TARGET_CLASS)
public DiscoveryClient discoveryClient() {
return DiscoveryManager.getInstance().getDiscoveryClient();
}

10
spring-platform-netflix-core/src/main/java/org/springframework/platform/netflix/eureka/EurekaInstanceConfigBean.java

@ -66,7 +66,7 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig { @@ -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 { @@ -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 { @@ -118,7 +124,7 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
@Override
public String getHostName(boolean refresh) {
return hostname;
return preferIpAddress ? ipAddress : hostname;
}
}

Loading…
Cancel
Save