Commit 093354e2 by Dave Syer

Check if client is in bootstrap and default to not register

Eureka now has the option (maybe always there) to not register and that's a sensible default in the bootstrap phase (when we might not know the port yet).
parent d5f6dbe1
...@@ -93,7 +93,13 @@ public class EurekaClientAutoConfiguration { ...@@ -93,7 +93,13 @@ public class EurekaClientAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean(value = EurekaClientConfig.class, search = SearchStrategy.CURRENT) @ConditionalOnMissingBean(value = EurekaClientConfig.class, search = SearchStrategy.CURRENT)
public EurekaClientConfigBean eurekaClientConfigBean() { public EurekaClientConfigBean eurekaClientConfigBean() {
return new EurekaClientConfigBean(); EurekaClientConfigBean client = new EurekaClientConfigBean();
if ("bootstrap".equals(this.env.getProperty("spring.config.name"))) {
// We don't register during bootstrap by default, but there will be another
// chance later.
client.setRegisterWithEureka(false);
}
return client;
} }
@Bean @Bean
......
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