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,7 +34,6 @@ | ||
| 34 | <rocketmq-spring.version>2.2.3</rocketmq-spring.version> | 34 | <rocketmq-spring.version>2.2.3</rocketmq-spring.version> |
| 35 | <!-- 服务保障相关 --> | 35 | <!-- 服务保障相关 --> |
| 36 | <lock4j.version>2.2.7</lock4j.version> | 36 | <lock4j.version>2.2.7</lock4j.version> |
| 37 | - <resilience4j.version>2.1.0</resilience4j.version> | ||
| 38 | <!-- 监控相关 --> | 37 | <!-- 监控相关 --> |
| 39 | <skywalking.version>9.0.0</skywalking.version> | 38 | <skywalking.version>9.0.0</skywalking.version> |
| 40 | <spring-boot-admin.version>3.2.1</spring-boot-admin.version> | 39 | <spring-boot-admin.version>3.2.1</spring-boot-admin.version> |
| @@ -282,17 +281,6 @@ | @@ -282,17 +281,6 @@ | ||
| 282 | </exclusions> | 281 | </exclusions> |
| 283 | </dependency> | 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 | <dependency> | 285 | <dependency> |
| 298 | <groupId>cn.iocoder.boot</groupId> | 286 | <groupId>cn.iocoder.boot</groupId> |
yudao-framework/yudao-spring-boot-starter-protection/pom.xml
| @@ -35,12 +35,6 @@ | @@ -35,12 +35,6 @@ | ||
| 35 | <artifactId>lock4j-redisson-spring-boot-starter</artifactId> | 35 | <artifactId>lock4j-redisson-spring-boot-starter</artifactId> |
| 36 | <optional>true</optional> | 36 | <optional>true</optional> |
| 37 | </dependency> | 37 | </dependency> |
| 38 | - | ||
| 39 | - <dependency> | ||
| 40 | - <groupId>io.github.resilience4j</groupId> | ||
| 41 | - <artifactId>resilience4j-spring-boot2</artifactId> | ||
| 42 | - <optional>true</optional> | ||
| 43 | - </dependency> | ||
| 44 | </dependencies> | 38 | </dependencies> |
| 45 | 39 | ||
| 46 | </project> | 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,6 +11,10 @@ import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; | ||
| 11 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; | 11 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 12 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; | 12 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 13 | import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; | 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 | import lombok.AllArgsConstructor; | 18 | import lombok.AllArgsConstructor; |
| 15 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
| 16 | import org.apache.commons.lang3.exception.ExceptionUtils; | 20 | import org.apache.commons.lang3.exception.ExceptionUtils; |
| @@ -26,13 +30,8 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; | @@ -26,13 +30,8 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; | ||
| 26 | import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; | 30 | import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; |
| 27 | import org.springframework.web.servlet.NoHandlerFoundException; | 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 | import java.time.LocalDateTime; | 33 | import java.time.LocalDateTime; |
| 34 | import java.util.Map; | 34 | import java.util.Map; |
| 35 | -import java.util.Objects; | ||
| 36 | 35 | ||
| 37 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; | 36 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; |
| 38 | 37 | ||
| @@ -182,14 +181,6 @@ public class GlobalExceptionHandler { | @@ -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 | * 处理 Spring Security 权限不足的异常 | 184 | * 处理 Spring Security 权限不足的异常 |
| 194 | * | 185 | * |
| 195 | * 来源是,使用 @PreAuthorize 注解,AOP 进行权限拦截 | 186 | * 来源是,使用 @PreAuthorize 注解,AOP 进行权限拦截 |
| @@ -223,12 +214,7 @@ public class GlobalExceptionHandler { | @@ -223,12 +214,7 @@ public class GlobalExceptionHandler { | ||
| 223 | return tableNotExistsResult; | 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 | log.error("[defaultExceptionHandler]", ex); | 218 | log.error("[defaultExceptionHandler]", ex); |
| 233 | // 插入异常日志 | 219 | // 插入异常日志 |
| 234 | this.createExceptionLog(req, ex); | 220 | this.createExceptionLog(req, ex); |
yudao-module-bpm/yudao-module-bpm-biz/src/test/resources/application-unit-test.yaml
| @@ -32,8 +32,6 @@ mybatis-plus: | @@ -32,8 +32,6 @@ mybatis-plus: | ||
| 32 | 32 | ||
| 33 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 33 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 34 | 34 | ||
| 35 | -# Resilience4j 配置项 | ||
| 36 | - | ||
| 37 | --- #################### 监控相关配置 #################### | 35 | --- #################### 监控相关配置 #################### |
| 38 | 36 | ||
| 39 | --- #################### 芋道相关配置 #################### | 37 | --- #################### 芋道相关配置 #################### |
yudao-module-crm/yudao-module-crm-biz/src/test/resources/application-unit-test.yaml
| @@ -39,8 +39,6 @@ mybatis-plus: | @@ -39,8 +39,6 @@ mybatis-plus: | ||
| 39 | 39 | ||
| 40 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 40 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 41 | 41 | ||
| 42 | -# Resilience4j 配置项 | ||
| 43 | - | ||
| 44 | --- #################### 监控相关配置 #################### | 42 | --- #################### 监控相关配置 #################### |
| 45 | 43 | ||
| 46 | --- #################### 芋道相关配置 #################### | 44 | --- #################### 芋道相关配置 #################### |
yudao-module-infra/yudao-module-infra-biz/src/test/resources/application-unit-test.yaml
| @@ -39,8 +39,6 @@ mybatis-plus: | @@ -39,8 +39,6 @@ mybatis-plus: | ||
| 39 | 39 | ||
| 40 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 40 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 41 | 41 | ||
| 42 | -# Resilience4j 配置项 | ||
| 43 | - | ||
| 44 | --- #################### 监控相关配置 #################### | 42 | --- #################### 监控相关配置 #################### |
| 45 | 43 | ||
| 46 | --- #################### 芋道相关配置 #################### | 44 | --- #################### 芋道相关配置 #################### |
yudao-module-mall/yudao-module-product-biz/src/test/resources/application-unit-test.yaml
| @@ -39,8 +39,6 @@ mybatis-plus: | @@ -39,8 +39,6 @@ mybatis-plus: | ||
| 39 | 39 | ||
| 40 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 40 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 41 | 41 | ||
| 42 | -# Resilience4j 配置项 | ||
| 43 | - | ||
| 44 | --- #################### 监控相关配置 #################### | 42 | --- #################### 监控相关配置 #################### |
| 45 | 43 | ||
| 46 | --- #################### 芋道相关配置 #################### | 44 | --- #################### 芋道相关配置 #################### |
yudao-module-mall/yudao-module-promotion-biz/src/test/resources/application-unit-test.yaml
| @@ -38,8 +38,6 @@ mybatis: | @@ -38,8 +38,6 @@ mybatis: | ||
| 38 | 38 | ||
| 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 40 | 40 | ||
| 41 | -# Resilience4j 配置项 | ||
| 42 | - | ||
| 43 | --- #################### 监控相关配置 #################### | 41 | --- #################### 监控相关配置 #################### |
| 44 | 42 | ||
| 45 | --- #################### 芋道相关配置 #################### | 43 | --- #################### 芋道相关配置 #################### |
yudao-module-mall/yudao-module-trade-biz/src/test/resources/application-unit-test.yaml
| @@ -38,8 +38,6 @@ mybatis: | @@ -38,8 +38,6 @@ mybatis: | ||
| 38 | 38 | ||
| 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 40 | 40 | ||
| 41 | -# Resilience4j 配置项 | ||
| 42 | - | ||
| 43 | --- #################### 监控相关配置 #################### | 41 | --- #################### 监控相关配置 #################### |
| 44 | 42 | ||
| 45 | --- #################### 芋道相关配置 #################### | 43 | --- #################### 芋道相关配置 #################### |
yudao-module-member/yudao-module-member-biz/src/test/resources/application-unit-test.yaml
| @@ -38,8 +38,6 @@ mybatis: | @@ -38,8 +38,6 @@ mybatis: | ||
| 38 | 38 | ||
| 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 40 | 40 | ||
| 41 | -# Resilience4j 配置项 | ||
| 42 | - | ||
| 43 | --- #################### 监控相关配置 #################### | 41 | --- #################### 监控相关配置 #################### |
| 44 | 42 | ||
| 45 | --- #################### 芋道相关配置 #################### | 43 | --- #################### 芋道相关配置 #################### |
yudao-module-pay/yudao-module-pay-biz/src/test-integration/resources/application-integration-test.yaml
| @@ -71,16 +71,6 @@ mybatis-plus: | @@ -71,16 +71,6 @@ mybatis-plus: | ||
| 71 | 71 | ||
| 72 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 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
| @@ -38,8 +38,6 @@ mybatis: | @@ -38,8 +38,6 @@ mybatis: | ||
| 38 | 38 | ||
| 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 40 | 40 | ||
| 41 | -# Resilience4j 配置项 | ||
| 42 | - | ||
| 43 | --- #################### 监控相关配置 #################### | 41 | --- #################### 监控相关配置 #################### |
| 44 | 42 | ||
| 45 | --- #################### 芋道相关配置 #################### | 43 | --- #################### 芋道相关配置 #################### |
yudao-module-report/yudao-module-report-biz/src/test/resources/application-unit-test.yaml
| @@ -38,8 +38,6 @@ mybatis: | @@ -38,8 +38,6 @@ mybatis: | ||
| 38 | 38 | ||
| 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 40 | 40 | ||
| 41 | -# Resilience4j 配置项 | ||
| 42 | - | ||
| 43 | --- #################### 监控相关配置 #################### | 41 | --- #################### 监控相关配置 #################### |
| 44 | 42 | ||
| 45 | --- #################### 芋道相关配置 #################### | 43 | --- #################### 芋道相关配置 #################### |
yudao-module-system/yudao-module-system-biz/src/test-integration/resources/application-integration-test.yaml
| @@ -75,16 +75,6 @@ mybatis: | @@ -75,16 +75,6 @@ mybatis: | ||
| 75 | 75 | ||
| 76 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 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
| @@ -38,8 +38,6 @@ mybatis: | @@ -38,8 +38,6 @@ mybatis: | ||
| 38 | 38 | ||
| 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) | 39 | # Lock4j 配置项(单元测试,禁用 Lock4j) |
| 40 | 40 | ||
| 41 | -# Resilience4j 配置项 | ||
| 42 | - | ||
| 43 | --- #################### 监控相关配置 #################### | 41 | --- #################### 监控相关配置 #################### |
| 44 | 42 | ||
| 45 | --- #################### 芋道相关配置 #################### | 43 | --- #################### 芋道相关配置 #################### |
yudao-server/src/main/resources/application-dev.yaml
| @@ -115,16 +115,6 @@ lock4j: | @@ -115,16 +115,6 @@ lock4j: | ||
| 115 | acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 | 115 | acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 |
| 116 | expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒 | 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 | # Actuator 监控端点的配置项 | 120 | # Actuator 监控端点的配置项 |
yudao-server/src/main/resources/application-local.yaml
| @@ -135,16 +135,6 @@ lock4j: | @@ -135,16 +135,6 @@ lock4j: | ||
| 135 | acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 | 135 | acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 |
| 136 | expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒 | 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 | # Actuator 监控端点的配置项 | 140 | # Actuator 监控端点的配置项 |