Commit 2e03dcba6946b4039fcd2b5b54c5f45106734918
1 parent
38db5fe0
移除 resilience4j 组件
Showing
19 changed files
with
5 additions
and
107 deletions
yudao-dependencies/pom.xml
| ... | ... | @@ -34,7 +34,6 @@ |
| 34 | 34 | <rocketmq-spring.version>2.2.3</rocketmq-spring.version> |
| 35 | 35 | <!-- 服务保障相关 --> |
| 36 | 36 | <lock4j.version>2.2.7</lock4j.version> |
| 37 | - <resilience4j.version>2.1.0</resilience4j.version> | |
| 38 | 37 | <!-- 监控相关 --> |
| 39 | 38 | <skywalking.version>9.0.0</skywalking.version> |
| 40 | 39 | <spring-boot-admin.version>3.2.1</spring-boot-admin.version> |
| ... | ... | @@ -282,17 +281,6 @@ |
| 282 | 281 | </exclusions> |
| 283 | 282 | </dependency> |
| 284 | 283 | |
| 285 | - <dependency> | |
| 286 | - <groupId>io.github.resilience4j</groupId> | |
| 287 | - <artifactId>resilience4j-ratelimiter</artifactId> | |
| 288 | - <version>${resilience4j.version}</version> | |
| 289 | - </dependency> | |
| 290 | - <dependency> | |
| 291 | - <groupId>io.github.resilience4j</groupId> | |
| 292 | - <artifactId>resilience4j-spring-boot2</artifactId> | |
| 293 | - <version>${resilience4j.version}</version> | |
| 294 | - </dependency> | |
| 295 | - | |
| 296 | 284 | <!-- 监控相关 --> |
| 297 | 285 | <dependency> |
| 298 | 286 | <groupId>cn.iocoder.boot</groupId> | ... | ... |
yudao-framework/yudao-spring-boot-starter-protection/pom.xml
| ... | ... | @@ -35,12 +35,6 @@ |
| 35 | 35 | <artifactId>lock4j-redisson-spring-boot-starter</artifactId> |
| 36 | 36 | <optional>true</optional> |
| 37 | 37 | </dependency> |
| 38 | - | |
| 39 | - <dependency> | |
| 40 | - <groupId>io.github.resilience4j</groupId> | |
| 41 | - <artifactId>resilience4j-spring-boot2</artifactId> | |
| 42 | - <optional>true</optional> | |
| 43 | - </dependency> | |
| 44 | 38 | </dependencies> |
| 45 | 39 | |
| 46 | 40 | </project> | ... | ... |
yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/resilience4j/package-info.java deleted
yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/resilience4j/《芋道 Spring Boot 服务容错 Resilience4j 入门》.md deleted
| 1 | -<https://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao> |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
| ... | ... | @@ -11,6 +11,10 @@ import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; |
| 11 | 11 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 12 | 12 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 13 | 13 | import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; |
| 14 | +import jakarta.servlet.http.HttpServletRequest; | |
| 15 | +import jakarta.validation.ConstraintViolation; | |
| 16 | +import jakarta.validation.ConstraintViolationException; | |
| 17 | +import jakarta.validation.ValidationException; | |
| 14 | 18 | import lombok.AllArgsConstructor; |
| 15 | 19 | import lombok.extern.slf4j.Slf4j; |
| 16 | 20 | import org.apache.commons.lang3.exception.ExceptionUtils; |
| ... | ... | @@ -26,13 +30,8 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; |
| 26 | 30 | import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; |
| 27 | 31 | import org.springframework.web.servlet.NoHandlerFoundException; |
| 28 | 32 | |
| 29 | -import jakarta.servlet.http.HttpServletRequest; | |
| 30 | -import jakarta.validation.ConstraintViolation; | |
| 31 | -import jakarta.validation.ConstraintViolationException; | |
| 32 | -import jakarta.validation.ValidationException; | |
| 33 | 33 | import java.time.LocalDateTime; |
| 34 | 34 | import java.util.Map; |
| 35 | -import java.util.Objects; | |
| 36 | 35 | |
| 37 | 36 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; |
| 38 | 37 | |
| ... | ... | @@ -182,14 +181,6 @@ public class GlobalExceptionHandler { |
| 182 | 181 | } |
| 183 | 182 | |
| 184 | 183 | /** |
| 185 | - * 处理 Resilience4j 限流抛出的异常 | |
| 186 | - */ | |
| 187 | - public CommonResult<?> requestNotPermittedExceptionHandler(HttpServletRequest req, Throwable ex) { | |
| 188 | - log.warn("[requestNotPermittedExceptionHandler][url({}) 访问过于频繁]", req.getRequestURL(), ex); | |
| 189 | - return CommonResult.error(TOO_MANY_REQUESTS); | |
| 190 | - } | |
| 191 | - | |
| 192 | - /** | |
| 193 | 184 | * 处理 Spring Security 权限不足的异常 |
| 194 | 185 | * |
| 195 | 186 | * 来源是,使用 @PreAuthorize 注解,AOP 进行权限拦截 |
| ... | ... | @@ -223,12 +214,7 @@ public class GlobalExceptionHandler { |
| 223 | 214 | return tableNotExistsResult; |
| 224 | 215 | } |
| 225 | 216 | |
| 226 | - // 情况二:部分特殊的库的处理 | |
| 227 | - if (Objects.equals("io.github.resilience4j.ratelimiter.RequestNotPermitted", ex.getClass().getName())) { | |
| 228 | - return requestNotPermittedExceptionHandler(req, ex); | |
| 229 | - } | |
| 230 | - | |
| 231 | - // 情况三:处理异常 | |
| 217 | + // 情况二:处理异常 | |
| 232 | 218 | log.error("[defaultExceptionHandler]", ex); |
| 233 | 219 | // 插入异常日志 |
| 234 | 220 | this.createExceptionLog(req, ex); | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/test/resources/application-unit-test.yaml
yudao-module-crm/yudao-module-crm-biz/src/test/resources/application-unit-test.yaml
yudao-module-infra/yudao-module-infra-biz/src/test/resources/application-unit-test.yaml
yudao-module-mall/yudao-module-product-biz/src/test/resources/application-unit-test.yaml
yudao-module-mall/yudao-module-promotion-biz/src/test/resources/application-unit-test.yaml
yudao-module-mall/yudao-module-trade-biz/src/test/resources/application-unit-test.yaml
yudao-module-member/yudao-module-member-biz/src/test/resources/application-unit-test.yaml
yudao-module-pay/yudao-module-pay-biz/src/test-integration/resources/application-integration-test.yaml
| ... | ... | @@ -71,16 +71,6 @@ mybatis-plus: |
| 71 | 71 | |
| 72 | 72 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 73 | 73 | |
| 74 | -# Resilience4j 配置项 | |
| 75 | -resilience4j: | |
| 76 | - ratelimiter: | |
| 77 | - instances: | |
| 78 | - backendA: | |
| 79 | - limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50 | |
| 80 | - limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500 | |
| 81 | - timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s | |
| 82 | - register-health-indicator: true # 是否注册到健康监测 | |
| 83 | - | |
| 84 | 74 | --- #################### 监控相关配置 #################### |
| 85 | 75 | |
| 86 | 76 | --- #################### 芋道相关配置 #################### | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/test/resources/application-unit-test.yaml
yudao-module-report/yudao-module-report-biz/src/test/resources/application-unit-test.yaml
yudao-module-system/yudao-module-system-biz/src/test-integration/resources/application-integration-test.yaml
| ... | ... | @@ -75,16 +75,6 @@ mybatis: |
| 75 | 75 | |
| 76 | 76 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 77 | 77 | |
| 78 | -# Resilience4j 配置项 | |
| 79 | -resilience4j: | |
| 80 | - ratelimiter: | |
| 81 | - instances: | |
| 82 | - backendA: | |
| 83 | - limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50 | |
| 84 | - limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500 | |
| 85 | - timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s | |
| 86 | - register-health-indicator: true # 是否注册到健康监测 | |
| 87 | - | |
| 88 | 78 | --- #################### 监控相关配置 #################### |
| 89 | 79 | |
| 90 | 80 | --- #################### 芋道相关配置 #################### | ... | ... |
yudao-module-system/yudao-module-system-biz/src/test/resources/application-unit-test.yaml
yudao-server/src/main/resources/application-dev.yaml
| ... | ... | @@ -115,16 +115,6 @@ lock4j: |
| 115 | 115 | acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 |
| 116 | 116 | expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒 |
| 117 | 117 | |
| 118 | -# Resilience4j 配置项 | |
| 119 | -resilience4j: | |
| 120 | - ratelimiter: | |
| 121 | - instances: | |
| 122 | - backendA: | |
| 123 | - limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50 | |
| 124 | - limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500 | |
| 125 | - timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s | |
| 126 | - register-health-indicator: true # 是否注册到健康监测 | |
| 127 | - | |
| 128 | 118 | --- #################### 监控相关配置 #################### |
| 129 | 119 | |
| 130 | 120 | # Actuator 监控端点的配置项 | ... | ... |
yudao-server/src/main/resources/application-local.yaml
| ... | ... | @@ -135,16 +135,6 @@ lock4j: |
| 135 | 135 | acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 |
| 136 | 136 | expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒 |
| 137 | 137 | |
| 138 | -# Resilience4j 配置项 | |
| 139 | -resilience4j: | |
| 140 | - ratelimiter: | |
| 141 | - instances: | |
| 142 | - backendA: | |
| 143 | - limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50 | |
| 144 | - limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500 | |
| 145 | - timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s | |
| 146 | - register-health-indicator: true # 是否注册到健康监测 | |
| 147 | - | |
| 148 | 138 | --- #################### 监控相关配置 #################### |
| 149 | 139 | |
| 150 | 140 | # Actuator 监控端点的配置项 | ... | ... |