feat: add global fallback support for AspectJ annotation extension (#3110)#3617
feat: add global fallback support for AspectJ annotation extension (#3110)#3617EvanYao826 wants to merge 1 commit into
Conversation
|
I have read and fully agree to the Contributor License Agreement (CLA). |
1 similar comment
|
I have read and fully agree to the Contributor License Agreement (CLA). |
|
The CLA check failed. Please ensure that your commit email matches your GitHub account email. |
|
@CLAassistant recheck please. I have signed the CLA. |
|
@LearningGp I will fix the commit email to use the GitHub noreply format ( |
6df4b3f to
96def8c
Compare
|
@LearningGp Thanks for pointing this out! The commit author email has been updated to the GitHub noreply format ( Please let me know if there are any other issues! |
|
I have read the CLA Document and I hereby sign the CLA |
…libaba#3110) Add SentinelAnnotationGlobalFallback interface and integrate it into AbstractSentinelAspectSupport as a last-resort fallback handler. When set on SentinelResourceAspect, the global fallback is invoked for all @SentinelResource-annotated methods when neither per-method fallback nor defaultFallback is configured (or found). This provides a universal 兜底 strategy without requiring each annotation to specify its own fallback. Changes: - New: SentinelAnnotationGlobalFallback interface with handle(Method, Object[], Throwable) contract - Modified: AbstractSentinelAspectSupport adds setGlobalFallback/getGlobalFallback - Modified: handleDefaultFallback() tries global fallback before throwing - Tests: 3 unit tests for get/set/clear global fallback Usage: SentinelResourceAspect aspect = new SentinelResourceAspect(); aspect.setGlobalFallback((method, args, t) -> { return "Global fallback: " + t.getMessage(); }); Fixes alibaba#3110
96def8c to
530eb1f
Compare
|
Fixed the CLA issue - updated committer email to match my GitHub account email (2869018789@qq.com). Please recheck. |
|
@LearningGp Fixed the CLA issue - updated committer email to match GitHub account (2869018789@qq.com). Please recheck. |
Fixes #3110
Summary
Add
SentinelAnnotationGlobalFallbackinterface and integrate it intoAbstractSentinelAspectSupportas a last-resort fallback handler.When set on
SentinelResourceAspect, the global fallback is invoked for all@SentinelResource-annotated methods when neither per-methodfallbacknordefaultFallbackis configured (or found). This provides a universal 兜底 strategy without requiring each annotation to specify its own fallback.Design
Follows the direction suggested by @sczyh30 in #3116: the global fallback lives in
SentinelResourceAspect(not in the annotation), making it a cross-cutting concern.Fallback resolution order:
fallback(annotation attribute)defaultFallback(annotation attribute or class-level)Changes
New:
SentinelAnnotationGlobalFallbackinterfaceModified:
AbstractSentinelAspectSupportglobalFallbackfield with getter/setterhandleDefaultFallback()to try global fallback before throwingTests
3 unit tests for get/set/clear global fallback on
AbstractSentinelAspectSupportTest.Usage
Notes
globalFallbackfield isvolatilefor thread-safe reads in the aspect's@Aroundadvice.