Global @ControllerAdvice or exception handler for Spring Web | Spring的全局异常处理器,会导致熔断规则(异常数规则)失效
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
现在有一个问题就是我创建了一个统一的BlockException处理 (实现BlockExceptionHandler),我希望在我的项目中对限流,和熔断做统一的降级处理,但是问题就是该项目中有全局异常处理器,导致我配置的熔断规则(根据异常数来判断是否熔断)失效,猜测原因是 spring的全局异常处理器将服务抛出的异常捕获到并处理了,sentinel那边就捕捉不到异常,从而无法统计异常数。
我想问问这种情况有什么解决办法吗,因为全局异常处理器是项目之前有的也不好去除。
---
Spring Interceptor cannot record the exception if a global `@ControllerAdvice` or exception handler has been set.
Contributor guide
Research direction
Start by reproducing the interaction between the Spring Interceptor, a global @ControllerAdvice or exception handler, and the custom BlockExceptionHandler. Trace where the exception is captured and whether Sentinel can record it for exception-count circuit breaking. Done means a documented or tested resolution that preserves unified degradation handling while keeping exception statistics effective.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100