|
|
@ -22,20 +22,26 @@ import com.tencent.cloud.polaris.discovery.PolarisServiceDiscovery;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
|
|
|
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
|
|
|
|
import org.springframework.cloud.client.ConditionalOnDiscoveryHealthIndicatorEnabled;
|
|
|
|
import org.springframework.cloud.client.ConditionalOnReactiveDiscoveryEnabled;
|
|
|
|
import org.springframework.cloud.client.ConditionalOnReactiveDiscoveryEnabled;
|
|
|
|
import org.springframework.cloud.client.ReactiveCommonsClientAutoConfiguration;
|
|
|
|
import org.springframework.cloud.client.ReactiveCommonsClientAutoConfiguration;
|
|
|
|
import org.springframework.cloud.client.discovery.composite.reactive.ReactiveCompositeDiscoveryClientAutoConfiguration;
|
|
|
|
import org.springframework.cloud.client.discovery.composite.reactive.ReactiveCompositeDiscoveryClientAutoConfiguration;
|
|
|
|
|
|
|
|
import org.springframework.cloud.client.discovery.health.DiscoveryClientHealthIndicatorProperties;
|
|
|
|
|
|
|
|
import org.springframework.cloud.client.discovery.health.reactive.ReactiveDiscoveryClientHealthIndicator;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Reactive Discovery Client Configuration for Polaris.
|
|
|
|
* Reactive Discovery Client Configuration for Polaris.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Haotian Zhang, Andrew Shan, Jie Cheng
|
|
|
|
* @author Haotian Zhang, Andrew Shan, Jie Cheng, youta
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@ConditionalOnReactiveDiscoveryEnabled
|
|
|
|
@ConditionalOnReactiveDiscoveryEnabled
|
|
|
|
|
|
|
|
@EnableConfigurationProperties(DiscoveryClientHealthIndicatorProperties.class)
|
|
|
|
@AutoConfigureAfter({PolarisDiscoveryAutoConfiguration.class, ReactiveCompositeDiscoveryClientAutoConfiguration.class})
|
|
|
|
@AutoConfigureAfter({PolarisDiscoveryAutoConfiguration.class, ReactiveCompositeDiscoveryClientAutoConfiguration.class})
|
|
|
|
@AutoConfigureBefore({ReactiveCommonsClientAutoConfiguration.class})
|
|
|
|
@AutoConfigureBefore({ReactiveCommonsClientAutoConfiguration.class})
|
|
|
|
public class PolarisReactiveDiscoveryClientConfiguration {
|
|
|
|
public class PolarisReactiveDiscoveryClientConfiguration {
|
|
|
@ -46,4 +52,12 @@ public class PolarisReactiveDiscoveryClientConfiguration {
|
|
|
|
PolarisServiceDiscovery polarisServiceDiscovery) {
|
|
|
|
PolarisServiceDiscovery polarisServiceDiscovery) {
|
|
|
|
return new PolarisReactiveDiscoveryClient(polarisServiceDiscovery);
|
|
|
|
return new PolarisReactiveDiscoveryClient(polarisServiceDiscovery);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
@ConditionalOnClass(name = "org.springframework.boot.actuate.health.ReactiveHealthIndicator")
|
|
|
|
|
|
|
|
@ConditionalOnDiscoveryHealthIndicatorEnabled
|
|
|
|
|
|
|
|
public ReactiveDiscoveryClientHealthIndicator polarisReactiveDiscoveryClientHealthIndicator(
|
|
|
|
|
|
|
|
PolarisReactiveDiscoveryClient client, DiscoveryClientHealthIndicatorProperties properties) {
|
|
|
|
|
|
|
|
return new ReactiveDiscoveryClientHealthIndicator(client, properties);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|