Skip to content

Commit

Permalink
fix: 修复熔断无法加载的问题 (#166)
Browse files Browse the repository at this point in the history
* fix: optimize the discovery inject logic and fix nacos config not working issue

* feat: 删除无用的导入

* feat: 增加actuator到demo中

* fix: add lossless healthcheck for example

* fix: add configuration comments

* fix: 修复事件日志不输出的问题

* release: release version to 1.7.0-RC1

* feat: new add java agent for hoxton

* feat: support service registry and config

* feat: refrator all inject logics into BeanInjector

* feat: add gray release example & dispatch bean register into plugins

* feat: add environment parameter to obtain the configuration

* feat: 增加元数据传输相关拦截器

* feat: 调整example打包脚本

* fix: 修复脚本没法跳转的问题

* fix: 修正样例的配置文件

* fix: 修复熔断无法加载的问题

* fix: 更新北极星的版本号依赖
  • Loading branch information
andrewshan authored May 10, 2024
1 parent 07d5773 commit 99c15fc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ spring.cloud.nacos.config.serverAddr=127.0.0.1:8848
spring.cloud.nacos.username='nacos'
spring.cloud.nacos.password='nacos'
management.endpoint.health.show-details=always
management.endpoints.web.exposure.include='*'
feign.hystrix.enabled=true
management.endpoints.web.exposure.include='*'
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
public class CircuitBreakerBeanInjector implements BeanInjector {
@Override
public void onBootstrapStartup(Object configurationParser, Constructor<?> configClassCreator, Method processConfigurationClass, BeanDefinitionRegistry registry, Environment environment) {

Object polarisCircuitBreakerBootstrapConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, PolarisCircuitBreakerBootstrapConfiguration.class, "polarisCircuitBreakerBootstrapConfiguration");
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, polarisCircuitBreakerBootstrapConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("polarisCircuitBreakerBootstrapConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
Expand All @@ -40,10 +39,13 @@ public void onApplicationStartup(Object configurationParser, Constructor<?> conf
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, polarisCircuitBreakerAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("polarisCircuitBreakerAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
PolarisCircuitBreakerAutoConfiguration.class).getBeanDefinition());
Object reactivePolarisCircuitBreakerAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, ReactivePolarisCircuitBreakerAutoConfiguration.class, "reactivePolarisCircuitBreakerAutoConfiguration");
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, reactivePolarisCircuitBreakerAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("reactivePolarisCircuitBreakerAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
ReactivePolarisCircuitBreakerAutoConfiguration.class).getBeanDefinition());
if (null != ClassUtils.getClazz("reactor.core.publisher.Mono", Thread.currentThread().getContextClassLoader())
&& null != ClassUtils.getClazz("reactor.core.publisher.Flux", Thread.currentThread().getContextClassLoader())) {
Object reactivePolarisCircuitBreakerAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, ReactivePolarisCircuitBreakerAutoConfiguration.class, "reactivePolarisCircuitBreakerAutoConfiguration");
ReflectionUtils.invokeMethod(processConfigurationClass, configurationParser, reactivePolarisCircuitBreakerAutoConfiguration, Constant.DEFAULT_EXCLUSION_FILTER);
registry.registerBeanDefinition("reactivePolarisCircuitBreakerAutoConfiguration", BeanDefinitionBuilder.genericBeanDefinition(
ReactivePolarisCircuitBreakerAutoConfiguration.class).getBeanDefinition());
}
if (null != ClassUtils.getClazz("feign.Feign", Thread.currentThread().getContextClassLoader())
&& null != ClassUtils.getClazz("org.springframework.cloud.openfeign.FeignClientFactoryBean", Thread.currentThread().getContextClassLoader())) {
Object polarisCircuitBreakerFeignClientAutoConfiguration = ReflectionUtils.invokeConstructor(configClassCreator, PolarisCircuitBreakerFeignClientAutoConfiguration.class, "polarisCircuitBreakerFeignClientAutoConfiguration");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ConfigurationParserInterceptor() {
beanInjectors.add(new LosslessBeanInjector());
beanInjectors.add(new LoadbalancerBeanInjector());
beanInjectors.add(new RouterBeanInjector());
//beanInjectors.add(new CircuitBreakerBeanInjector());
beanInjectors.add(new CircuitBreakerBeanInjector());
beanInjectors.add(new RateLimitBeanInjector());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ spring.cloud.polaris.discovery.namespace=default
spring.cloud.polaris.discovery.enabled=true
spring.cloud.polaris.discovery.register=true

## 是否启用北极星的 LoadBalancer
# 是否启用北极星的 LoadBalancer
spring.cloud.polaris.loadbalancer.enabled=true
#spring.cloud.polaris.loadbalancer.discoveryType=POLARIS
#spring.cloud.polaris.loadbalancer.strategy=random

## 是否启用北极星服务路由能力
spring.cloud.polaris.router.enabled=false
# 是否启用北极星服务路由能力
spring.cloud.polaris.router.enabled=true
# 是否启用北极星的自定义路由能力
spring.cloud.polaris.router.rule-router.enabled=false
spring.cloud.polaris.router.rule-router.enabled=true
# 是否启用北极星的元数据路由能力
spring.cloud.polaris.router.metadata-router.enabled=false
spring.cloud.polaris.router.metadata-router.enabled=true
# 是否启用北极星的就近路由能力
spring.cloud.polaris.router.nearby-router.enabled=false
spring.cloud.polaris.router.nearby-router.enabled=true

## 是否启用北极星的服务限流能力
# 是否启用北极星的服务限流能力
spring.cloud.polaris.ratelimit.enabled=true
# 设置触发限流时的提示信息
# spring.cloud.polaris.ratelimit.rejectRequestTips=""
Expand All @@ -33,6 +33,8 @@ spring.cloud.polaris.ratelimit.rejectHttpCode=429
# 设置限流匀速排队最大排队时间
spring.cloud.polaris.ratelimit.maxQueuingTime=1000

# 是否启用北极星的服务熔断能力
spring.cloud.polaris.circuitbreaker.enabled=true

## RPC 调用增强
spring.cloud.tencent.rpc-enhancement.enabled=true
Expand All @@ -47,7 +49,7 @@ spring.cloud.polaris.stat.port=0
spring.cloud.polaris.stat.path=/metrics

## 启用北极星配置中心能力
spring.cloud.polaris.config.enabled=false
spring.cloud.polaris.config.enabled=true
# 是否开启配置监听刷新
spring.cloud.polaris.config.auto-refresh=true

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<properties>
<revision>1.7.0-RC2</revision>
<polaris.version>1.15.4</polaris.version>
<polaris.version>1.15.5-SNAPSHOT</polaris.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skip.maven.deploy>false</skip.maven.deploy>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down

0 comments on commit 99c15fc

Please sign in to comment.