When using @Transactional in a service layer, is there any option to get a reference to the TransactionStatus instance created by the PlatformTransactionManager?
For instance, in the following code :
@Transactional
public void updateCustomer(...) {
// do some business stuff
// can we get here a reference to the TransactionStatus instance ?
}
The
currentTransactionStatusmethod returns the transaction status of the current method invocation.If you are interested in the result of a transaction, you could consider the
TransactionSynchronizationAdapterwhich provides a convenientafterCompletion(int status)callback: