47
47
public class TransactionalApplicationListenerMethodAdapter extends ApplicationListenerMethodAdapter
48
48
implements TransactionalApplicationListener <ApplicationEvent > {
49
49
50
- private final TransactionalEventListener annotation ;
51
-
52
50
private final TransactionPhase transactionPhase ;
53
51
52
+ private final boolean fallbackExecution ;
53
+
54
54
private final List <SynchronizationCallback > callbacks = new CopyOnWriteArrayList <>();
55
55
56
56
@@ -63,12 +63,12 @@ public class TransactionalApplicationListenerMethodAdapter extends ApplicationLi
63
63
public TransactionalApplicationListenerMethodAdapter (String beanName , Class <?> targetClass , Method method ) {
64
64
super (beanName , targetClass , method );
65
65
TransactionalEventListener eventAnn =
66
- AnnotatedElementUtils .findMergedAnnotation (method , TransactionalEventListener .class );
66
+ AnnotatedElementUtils .findMergedAnnotation (getTargetMethod () , TransactionalEventListener .class );
67
67
if (eventAnn == null ) {
68
68
throw new IllegalStateException ("No TransactionalEventListener annotation found on method: " + method );
69
69
}
70
- this .annotation = eventAnn ;
71
70
this .transactionPhase = eventAnn .phase ();
71
+ this .fallbackExecution = eventAnn .fallbackExecution ();
72
72
}
73
73
74
74
@@ -91,8 +91,8 @@ public void onApplicationEvent(ApplicationEvent event) {
91
91
logger .debug ("Registered transaction synchronization for " + event );
92
92
}
93
93
}
94
- else if (this .annotation . fallbackExecution () ) {
95
- if (this . annotation . phase () == TransactionPhase .AFTER_ROLLBACK && logger .isWarnEnabled ()) {
94
+ else if (this .fallbackExecution ) {
95
+ if (getTransactionPhase () == TransactionPhase .AFTER_ROLLBACK && logger .isWarnEnabled ()) {
96
96
logger .warn ("Processing " + event + " as a fallback execution on AFTER_ROLLBACK phase" );
97
97
}
98
98
processEvent (event );
0 commit comments