Merge pull request #2418 from DanielLiu1123/fix-2405

Optimize Sentinel module code.
pull/2421/head
Freeman Lau 3 years ago committed by GitHub
commit 366675329b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,19 +16,17 @@
在启动示例进行演示之前,我们先了解一下 Feign 如何接入 Sentinel。
**注意 本章节只是为了便于您理解接入方式,本示例代码中已经完成接入工作,您无需再进行修改。**
1. 首先,修改 pom.xml 文件,引入 Sentinel starter 和 Dubbo starter。
1. 首先,修改 pom.xml 文件,引入 Sentinel starter 和 Openfeign starter。
```xml
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
```
2. 其次, 使用nacos 注册中心

@ -16,7 +16,7 @@ Service consumer
Before launching the example, let's see how Feign can access Sentinel.
** note that this section is for your convenience only. The access has been completed in this sample code and you do not need to modify it. * *
First, modify the pom.xml file to introduce Sentinel starter and Dubbo starter.
First, modify the pom.xml file to introduce Sentinel starter and Openfeign starter.
```xml
<dependency>

@ -30,9 +30,6 @@ import static com.alibaba.cloud.circuitbreaker.sentinel.feign.CircuitBreakerRule
/**
* Feign client circuit breaker name resolver.
*
* <p>
* <strong>note:</strong> spring cloud openfeign version need greater than 3.0.4.
*
* @author freeman
* @see CircuitBreakerNameResolver
*/

@ -61,7 +61,6 @@ public class SentinelFeignClientAutoConfiguration {
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(CircuitBreakerNameResolver.class)
public static class CircuitBreakerNameResolverConfiguration {
@Bean

@ -55,6 +55,7 @@ import static com.alibaba.csp.sentinel.config.SentinelConfig.setConfig;
* @author xiaojing
* @author jiashuai.xie
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
* @author freeman
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.cloud.sentinel.enabled", matchIfMissing = true)
@ -147,7 +148,7 @@ public class SentinelAutoConfiguration {
@ConditionalOnClass(name = "org.springframework.web.client.RestTemplate")
@ConditionalOnProperty(name = "resttemplate.sentinel.enabled", havingValue = "true",
matchIfMissing = true)
public SentinelBeanPostProcessor sentinelBeanPostProcessor(
public static SentinelBeanPostProcessor sentinelBeanPostProcessor(
ApplicationContext applicationContext) {
return new SentinelBeanPostProcessor(applicationContext);
}

@ -19,11 +19,15 @@ package com.alibaba.cloud.sentinel.custom;
import org.springframework.context.annotation.Configuration;
/**
* Support @EnableCircuitBreaker, Do nothing.
*
* @author lengleng
* <p>
* support @EnableCircuitBreaker ,Do nothing
* @author freeman
* @deprecated since 2021.0.1.0, see
* {@link org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker}
*/
@Configuration(proxyBeanMethods = false)
@Deprecated
public class SentinelCircuitBreakerConfiguration {
}

Loading…
Cancel
Save