Home > Java > javaTutorial > body text

How to do asynchronous operation after spring transaction commit

巴扎黑
Release: 2017-07-24 15:51:20
Original
3764 people have browsed it

Content of this article

How to perform asynchronous operations after the spring transaction is submitted. These asynchronous operations must be executed after the transaction is successfully submitted, and rollback will not be executed.

Key Points

  • How to operate after the spring transaction is submitted

  • How to asynchronousize the operation

Implementation plan

Use TransactionSynchronizationManager to operate after transaction submission

// send after tx commit but is asyncTransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
            @Overridepublic void afterCommit() {
                System.out.println("send email after transaction commit...");
            }
        }
       );
Copy after login

The above is the detailed content of How to do asynchronous operation after spring transaction commit. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!