Repository navigation
GH-1118 - Detect @DomainEvent in the type hierarchy of published events - #1875
Closed
hunseonglee wants to merge 1 commit into
Closed
hunseonglee wants to merge 1 commit into
hunseonglee wants to merge 1 commit into
Conversation
… published events. Published event detection only considered @domainevent annotations declared directly on the event type. Events inheriting the annotation from an implemented interface or a superclass were not listed in ApplicationModule#getPublishedEvents(). @inherited on the jMolecules side would not cover the reported arrangement either, as it only propagates along superclasses, not implemented interfaces. Event detection now traverses the type hierarchy (superclasses and implemented interfaces) and also considers meta-annotations, so that custom annotations composed with @domainevent are detected as well. Signed-off-by: seonghun lee <harrisleesh@gmail.com>
odrotbohm
pushed a commit
that referenced
this pull request
Sep 17, 2026
Published event detection only considered @domainevent annotations declared directly on the event type. Events inheriting the annotation from an implemented interface or a superclass were not listed in ApplicationModule#getPublishedEvents(). @inherited on the jMolecules side would not cover the reported arrangement either, as it only propagates along superclasses, not implemented interfaces. Event detection now traverses the type hierarchy (superclasses and implemented interfaces) and also considers meta-annotations, so that custom annotations composed with @domainevent are detected as well. Original pull request: GH-1875 Signed-off-by: seonghun lee <harrisleesh@gmail.com>
odrotbohm
pushed a commit
that referenced
this pull request
Sep 17, 2026
Published event detection only considered @domainevent annotations declared directly on the event type. Events inheriting the annotation from an implemented interface or a superclass were not listed in ApplicationModule#getPublishedEvents(). @inherited on the jMolecules side would not cover the reported arrangement either, as it only propagates along superclasses, not implemented interfaces. Event detection now traverses the type hierarchy (superclasses and implemented interfaces) and also considers meta-annotations, so that custom annotations composed with @domainevent are detected as well. Original pull request: GH-1875 Signed-off-by: seonghun lee <harrisleesh@gmail.com>
odrotbohm
pushed a commit
that referenced
this pull request
Sep 17, 2026
Published event detection only considered @domainevent annotations declared directly on the event type. Events inheriting the annotation from an implemented interface or a superclass were not listed in ApplicationModule#getPublishedEvents(). @inherited on the jMolecules side would not cover the reported arrangement either, as it only propagates along superclasses, not implemented interfaces. Event detection now traverses the type hierarchy (superclasses and implemented interfaces) and also considers meta-annotations, so that custom annotations composed with @domainevent are detected as well. Original pull request: GH-1875 Signed-off-by: seonghun lee <harrisleesh@gmail.com>
Member
|
That's polished, merged, and back-ported. |
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.
Follows up on my comment on the issue: since
@Inheritedonly propagates along superclasses (never implemented interfaces), the arrangement reported in GH-1118 — an annotated root interface — cannot be fixed by adding@Inheritedto the jMolecules annotations, so a Modulith-side hierarchy-aware lookup seems needed either way. If you'd still rather solve this differently, happy to adapt or close.Published event detection only considered
@DomainEventdeclared directly on the event type. This change makesApplicationModule#findPublishedEvents()traverse the type hierarchy (superclasses and implemented interfaces) and also consider meta-annotations, so custom annotations composed with@DomainEventare detected as well.The added fixtures cover both shapes: a class implementing an
@DomainEvent-annotated interface (the reported case) and a class extending an annotated superclass.discoversPublishedEventsfails onmainfor both and passes with the change; the fullspring-modulith-coresuite passes.The
@DomainEventHandlerand meta-annotated@NamedInterfacecases from the follow-up comments are not covered here — happy to address those as separate PRs if you'd like.Closes GH-1118