Skip to content

Instantly share code, notes, and snippets.

@cherniag
Last active June 11, 2018 12:36
Show Gist options
  • Save cherniag/2b6b8048fe6781abea30a2ab04a87a36 to your computer and use it in GitHub Desktop.
Save cherniag/2b6b8048fe6781abea30a2ab04a87a36 to your computer and use it in GitHub Desktop.
Spring application event after transaction commit
need to perform some actions on entity after it had been commited using spring app events?
Use (instead of @EventListener):
@TransactionalEventListener(classes = MyEvent.class)
(note that inside new transaction is required to perform actions!)
https://spring.io/blog/2015/02/11/better-application-events-in-spring-framework-4-2
https://dzone.com/articles/transaction-synchronization-and-spring-application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment