我想在Spring 启动事务时收到通知。我知道org.springframework.transaction.support.TransactionSynchronizationManager
但是,您只能使用它来获取org.springframework.transaction.event.TransactionPhase
(BEFORE_COMMIT
,AFTER_COMPLETION
,AFTER_COMMIT
中定义的交易阶段的通知,AFTER_ROLLBACK
)。但是,如何在交易开始之前或之后得到通知?
答案 0 :(得分:1)
over over org.springframework.transaction.jta.JtaTransactionManager
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
//UUID code here
super.doBegin(transaction, definition);
}