Class MethodRollbackEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.context.event.MethodFailureEvent
org.springframework.transaction.interceptor.MethodRollbackEvent
- All Implemented Interfaces:
Serializable
public class MethodRollbackEvent
extends org.springframework.context.event.MethodFailureEvent
Event published for every exception encountered that triggers a transaction rollback
through a proxy-triggered method invocation or a reactive publisher returned from it.
Can be listened to via an
ApplicationListener<MethodRollbackEvent> bean or
an @EventListener(MethodRollbackEvent.class) method.
Note: This event gets published right before the actual transaction rollback.
As a consequence, the exposed transaction reflects the state
of the transaction right before the rollback.
- Since:
- 7.0.3
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionMethodRollbackEvent(org.aopalliance.intercept.MethodInvocation invocation, Throwable failure, TransactionExecution transaction) Create a new event for the given rolled-back method invocation. -
Method Summary
Modifier and TypeMethodDescriptionReturn the exception encountered.Return the corresponding transaction status.Methods inherited from class org.springframework.context.event.MethodFailureEvent
getMethod, getSource, toStringMethods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
-
Constructor Details
-
MethodRollbackEvent
public MethodRollbackEvent(org.aopalliance.intercept.MethodInvocation invocation, Throwable failure, TransactionExecution transaction) Create a new event for the given rolled-back method invocation.- Parameters:
invocation- the transactional method invocationfailure- the exception encountered that triggered a rollbacktransaction- the transaction status right before the rollback
-
-
Method Details
-
getFailure
Return the exception encountered.This may be an exception thrown by the method or emitted by the reactive publisher returned from the method.
- Overrides:
getFailurein classorg.springframework.context.event.MethodFailureEvent
-
getTransaction
Return the corresponding transaction status.
-