GH-1123 - Detect events configured for externalization published outside a transaction#1456
Open
yunhobb wants to merge 1 commit intospring-projects:mainfrom
Conversation
8ae599d to
e38c964
Compare
… published outside a transaction. Signed-off-by: yunhobb <[email protected]>
e38c964 to
2cc322a
Compare
yunhobb
commented
Feb 20, 2026
| Supplier<Environment> environment) { | ||
| this(registry, environment, EventExternalizationConfiguration::disabled); | ||
| } | ||
|
|
Author
There was a problem hiding this comment.
I added new 3-arg constructor but kept the old 2-arg one to not break existing API. The old one just delegates to new one with disabled config. If you think @deprecated is needed or want different approach, please let me know.
yunhobb
commented
Feb 20, 2026
Author
There was a problem hiding this comment.
The only way to verify this detection is checking log output, so I used Logback ListAppender to capture it. I see this pattern is not used in other tests in this project. If you prefer different way to test this, I'm happy to change.
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.
Summary
Events configured for externalization via
@Externalizedsilently fail when published outside a transaction context — they are neither persisted nor externalized. This can be difficult to diagnose.This change adds a warning log in
PersistentApplicationEventMulticasterto detect this scenario and inform developers with actionable guidance.Fixes #1123
Changes
EventExternalizationConfigurationas an optional dependency toPersistentApplicationEventMulticasterwith a backward-compatible two-argument constructor overloaddetectEventPublishedOutsideTransaction()that logs a warning when:ObjectProvider<EventExternalizationConfiguration>throughEventPublicationConfigurationandEventPublicationAutoConfigurationTransactionalEventListeners.hasListeners()Test plan