move config namespace to spring.cloud.consul.*
This commit is contained in:
@@ -20,7 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.bus.BusAutoConfiguration;
|
||||
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -40,7 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(ConsulClient.class)
|
||||
@ConditionalOnExpression("${bus.consul.enabled:true}")
|
||||
@ConditionalOnProperty(value = "spring.cloud.consul.bus.enabled", matchIfMissing = true)
|
||||
@AutoConfigureAfter(BusAutoConfiguration.class)
|
||||
@EnableScheduling
|
||||
public class ConsulBusAutoConfiguration {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@ConfigurationProperties("consul")
|
||||
@ConfigurationProperties("spring.cloud.consul")
|
||||
@Data
|
||||
public class ConsulProperties {
|
||||
@NotNull
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ConsulDiscoveryClientConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty("consul.heartbeat.enabled")
|
||||
@ConditionalOnProperty("spring.cloud.consul.discovery.heartbeat.enabled")
|
||||
public TtlScheduler ttlScheduler() {
|
||||
return new TtlScheduler(heartbeatProperties(), consulClient);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@ConfigurationProperties("consul.discovery")
|
||||
@ConfigurationProperties("spring.cloud.consul.discovery")
|
||||
@Data
|
||||
@CommonsLog
|
||||
public class ConsulDiscoveryProperties {
|
||||
|
||||
@@ -28,7 +28,7 @@ import lombok.extern.apachecommons.CommonsLog;
|
||||
import org.joda.time.Period;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(prefix = "consul.heartbeat")
|
||||
@ConfigurationProperties(prefix = "spring.cloud.consul.discovery.heartbeat")
|
||||
@Data
|
||||
@CommonsLog
|
||||
public class HeartbeatProperties {
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
@ConditionalOnBean(SpringClientFactory.class)
|
||||
@ConditionalOnProperty(value = "ribbon.consul.enabled", matchIfMissing = true)
|
||||
@ConditionalOnProperty(value = "spring.cloud.consul.ribbon.enabled", matchIfMissing = true)
|
||||
@AutoConfigureAfter(RibbonAutoConfiguration.class)
|
||||
@RibbonClients(defaultConfiguration = ConsulRibbonClientConfiguration.class)
|
||||
public class RibbonConsulAutoConfiguration {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TtlScheduler {
|
||||
serviceHeartbeats.remove(serviceId);
|
||||
}
|
||||
|
||||
@Scheduled(initialDelay = 0, fixedRateString = "${consul.heartbeat.fixedRate:15000}")
|
||||
@Scheduled(initialDelay = 0, fixedRateString = "${spring.cloud.consul.discovery.heartbeat.fixedRate:15000}")
|
||||
private void heartbeatServices() {
|
||||
for (String serviceId : serviceHeartbeats.keySet()) {
|
||||
DateTime latestHeartbeatDoneForService = serviceHeartbeats.get(serviceId);
|
||||
|
||||
Reference in New Issue
Block a user