Spring开始交易时的通知?

时间:2016-10-26 10:59:45

标签: java spring transactions

我想在Spring 启动事务时收到通知。我知道org.springframework.transaction.support.TransactionSynchronizationManager但是,您只能使用它来获取org.springframework.transaction.event.TransactionPhaseBEFORE_COMMITAFTER_COMPLETIONAFTER_COMMIT中定义的交易阶段的通知,AFTER_ROLLBACK)。但是,如何在交易开始之前或之后得到通知?

1 个答案:

答案 0 :(得分:1)

over over org.springframework.transaction.jta.JtaTransactionManager

@Override
protected void doBegin(Object transaction, TransactionDefinition definition) {
   //UUID code here
   super.doBegin(transaction, definition);
}