[#4705] Skip interceptor members when applying @SequencingPolicy#4706
Open
abuijze wants to merge 1 commit into
Open
[#4705] Skip interceptor members when applying @SequencingPolicy#4706abuijze wants to merge 1 commit into
abuijze wants to merge 1 commit into
Conversation
A class-level @SequencingPolicy was applied to any member able to handle EventMessages, which includes @ExceptionHandler and other interceptor members. The declared policy was then eagerly constructed against the member's payload type, which for an exception handler is the exception type. Property-based policies fail construction against that type, aborting component inspection and application startup. Interceptor members never participate in sequencing, so they are now excluded by checking for the MessageHandlerInterceptor.messageType attribute. Every interceptor member carries this attribute through annotation scanning, making the check independent of the order in which handler enhancers wrap the member. Resolves #4705.
MateuszNaKodach
approved these changes
Jul 3, 2026
| */ | ||
| public class MethodSequencingPolicyEventHandlerDefinition implements HandlerEnhancerDefinition { | ||
|
|
||
| private static final String INTERCEPTOR_MESSAGE_TYPE_ATTRIBUTE = |
Contributor
There was a problem hiding this comment.
This key derivation is now duplicated: MessageHandlerInterceptorDefinition.wrapHandler builds the identical "MessageHandlerInterceptor.messageType" string as a local variable, and this enhancer must stay in sync with it for the skip to work — if the key ever changes there, this check silently stops matching and the #4705 startup failure returns with no compile-time signal. Severity is low (the key is unlikely to change), but consider defining a shared constant, e.g. next to HandlerAttributes.MESSAGE_TYPE which already follows the same naming scheme, and referencing it from both definitions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #4705.
A class-level
@SequencingPolicywas applied to any member able to handleEventMessages, which includes@ExceptionHandlerand other interceptor members. The declared policy was then eagerly constructed against the member's payload type, which for an exception handler is the exception type. Property-based policies fail construction against that type, aborting component inspection and application startup for any projection combining a property-based class-level@SequencingPolicywith an@ExceptionHandler.Interceptor members never participate in sequencing (
AnnotatedEventHandlingComponentonly consults the sequencing wrapper for subscribed event handlers), soMethodSequencingPolicyEventHandlerDefinitionnow excludes them by checking for theMessageHandlerInterceptor.messageTypeattribute. Every interceptor member carries this attribute through annotation scanning, since@ExceptionHandleris meta-annotated with@MessageHandlerInterceptorand@ResultHandleronly exists as a meta-annotation. This makes the check independent of the order in which handler enhancers wrap the member.Includes an enhancer-level regression test asserting the exception handler member stays unwrapped, and the issue's
AnnotatedHandlerInspector.inspectTypereproducer. Both fail without the fix.