fix:Turn off automatic injection of Polars rule.

pull/162/head
SkyeBeFreeman 3 years ago
parent 34c95ca61a
commit c27ef60a1b

@ -1,4 +1,5 @@
# Change Log # Change Log
--- ---
- [fix:fix routes of gateway doesn't refresh bug.](https://github.com/Tencent/spring-cloud-tencent/pull/158) - [fix:fix routes of gateway doesn't refresh bug.](https://github.com/Tencent/spring-cloud-tencent/pull/158)
- [fix:Turn off automatic injection of Polars rule.](https://github.com/Tencent/spring-cloud-tencent/pull/152)

@ -24,8 +24,6 @@ import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.Server; import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerList; import com.netflix.loadbalancer.ServerList;
import com.tencent.cloud.polaris.loadbalancer.PolarisLoadBalancer; import com.tencent.cloud.polaris.loadbalancer.PolarisLoadBalancer;
import com.tencent.cloud.polaris.loadbalancer.rule.PolarisLoadBalanceRule;
import com.tencent.cloud.polaris.loadbalancer.rule.PolarisWeightedRandomRule;
import com.tencent.polaris.api.core.ConsumerAPI; import com.tencent.polaris.api.core.ConsumerAPI;
import com.tencent.polaris.router.api.core.RouterAPI; import com.tencent.polaris.router.api.core.RouterAPI;
@ -41,17 +39,17 @@ import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
public class PolarisRibbonClientConfiguration { public class PolarisRibbonClientConfiguration {
@Bean // @Bean
@ConditionalOnMissingBean // @ConditionalOnMissingBean
public IRule polarisRibbonRule( // public IRule polarisRibbonRule(
PolarisLoadBalancerProperties polarisLoadBalancerProperties) { // PolarisLoadBalancerProperties polarisLoadBalancerProperties) {
switch (PolarisLoadBalanceRule // switch (PolarisLoadBalanceRule
.fromStrategy(polarisLoadBalancerProperties.getStrategy())) { // .fromStrategy(polarisLoadBalancerProperties.getStrategy())) {
case WEIGHTED_RANDOM_RULE: // case WEIGHTED_RANDOM_RULE:
default: // default:
return new PolarisWeightedRandomRule(); // return new PolarisWeightedRandomRule();
} // }
} // }
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean

Loading…
Cancel
Save