Dev Tools · 3h ago
Spring @EventListener Fires Before Transaction Commit, Causing Bugs
Spring's @EventListener fires synchronously before the transaction commits, making DB rows invisible to other connections. A log statement can mask the issue by adding delay. Use @TransactionalEventListener with AFTER_COMMIT phase to ensure the row is visible.
Meridian48 take
A common pitfall for Spring developers that's easy to fix once you know the cause, but the silent failure pattern can waste hours of debugging.
spring-frameworktransaction-management