Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17316

TransactionalEventListener

    XMLWordPrintable

    Details

    • Last commented by a User:
      true

      Description

      When using

      @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)

      public void notificationOnCommit(Data myDataSaved){}

      it is possible to receive the event even though the data has not been saved successfully.

      I posted an example with the use of normal "@EventListener"

      --> the behaviour is "as expected" because of the use of "TransactionSynchronizationManager.isActualTransactionActive()"

       

      my guess is that when using "TransactionalEventListener"

      it does not work correctly because in the class "ApplicationListenerMethodTransactionalAdapter" the method "onApplicationEvent" is calling "TransactionSynchronizationManager.isSynchronizationActive()" instead of  "TransactionSynchronizationManager.isActualTransactionActive()"

       

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            clembo590 clembo590
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 24 weeks, 1 day ago