如果想在spring操作事务结束后执行一些代码,应该怎么办? 为什么要这样?比如我们在事务中给其他系统发了消息,期望事务提交后过一会收到这个系统的回应,然后操作刚刚提交的数据。但是如果回应来的太快就像龙卷风,我们的事务是托管给Spring的可能还没提交,也就没法操作了 一个方案是使用 ApplicationEventPublisher,可以参考我之前的千万访问量博客 https://www.iteye.com/blog/somefuture-2405963 登陆访问量是100多万,我就假设总访问量是10倍吧哈哈 这个API是 Spring 1 就提供的,从 Spring 5 开始,提供了一个新的事物相关的API,叫 TransactionSynchronization 事物同步机制。 先编写一个Bean实TransactionSynchronization接口 import org.springframework.transaction.support.TransactionSynchronization; import...
Import Org.springframework.transaction.support.transaction SynchronizationManager
As seen in:
cnblogs.com
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with Import Org.springframework.transaction.support.transaction
Contact Import Org.springframework.transaction.support.transaction, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack