Skip to content

[#4705] Skip interceptor members when applying @SequencingPolicy#4706

Open
abuijze wants to merge 1 commit into
mainfrom
bug/4705/sequencing-policy-exception-handlers
Open

[#4705] Skip interceptor members when applying @SequencingPolicy#4706
abuijze wants to merge 1 commit into
mainfrom
bug/4705/sequencing-policy-exception-handlers

Conversation

@abuijze

@abuijze abuijze commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Resolves #4705.

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 for any projection combining a property-based class-level @SequencingPolicy with an @ExceptionHandler.

Interceptor members never participate in sequencing (AnnotatedEventHandlingComponent only consults the sequencing wrapper for subscribed event handlers), so MethodSequencingPolicyEventHandlerDefinition now excludes them by checking for the MessageHandlerInterceptor.messageType attribute. Every interceptor member carries this attribute through annotation scanning, since @ExceptionHandler is meta-annotated with @MessageHandlerInterceptor and @ResultHandler only 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.inspectType reproducer. Both fail without the fix.

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.
@abuijze abuijze requested a review from a team as a code owner July 3, 2026 16:35
@abuijze abuijze requested review from MateuszNaKodach, hatzlj and hjohn and removed request for a team July 3, 2026 16:35
@abuijze abuijze self-assigned this Jul 3, 2026
@abuijze abuijze added Type: Bug Use to signal issues that describe a bug within the system. Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. labels Jul 3, 2026
@abuijze abuijze added this to the Release 5.2.0 milestone Jul 3, 2026
@abuijze abuijze requested a review from smcvb July 3, 2026 16:37
*/
public class MethodSequencingPolicyEventHandlerDefinition implements HandlerEnhancerDefinition {

private static final String INTERCEPTOR_MESSAGE_TYPE_ATTRIBUTE =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority 1: Must Highest priority. A release cannot be made if this issue isn’t resolved. Type: Bug Use to signal issues that describe a bug within the system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@SequencingPolicy is applied to @ExceptionHandler members, breaking startup (5.2.0-RC1)

2 participants