18
18
19
19
import java .util .concurrent .atomic .AtomicInteger ;
20
20
21
+ import org .jspecify .annotations .Nullable ;
22
+
21
23
import org .springframework .beans .BeansException ;
22
24
import org .springframework .beans .factory .BeanFactory ;
23
25
import org .springframework .beans .factory .BeanFactoryAware ;
38
40
* @author Artem Bilan
39
41
* @author Gary Russell
40
42
* @author Ngoc Nhan
43
+ * @author Glenn Renfro
41
44
*
42
45
* @since 4.0
43
46
*/
@@ -51,27 +54,28 @@ public class TransactionSynchronizationFactoryBean implements FactoryBean<Defaul
51
54
52
55
private final AtomicInteger counter = new AtomicInteger ();
53
56
57
+ @ SuppressWarnings ("NullAway.Init" )
54
58
private BeanFactory beanFactory ;
55
59
56
- private volatile String beforeCommitExpression ;
60
+ private volatile @ Nullable String beforeCommitExpression ;
57
61
58
- private volatile String afterCommitExpression ;
62
+ private volatile @ Nullable String afterCommitExpression ;
59
63
60
- private volatile String afterRollbackExpression ;
64
+ private volatile @ Nullable String afterRollbackExpression ;
61
65
62
- private volatile MessageChannel beforeCommitChannel ;
66
+ private volatile @ Nullable MessageChannel beforeCommitChannel ;
63
67
64
- private volatile String beforeCommitChannelName ;
68
+ private volatile @ Nullable String beforeCommitChannelName ;
65
69
66
- private volatile MessageChannel afterCommitChannel ;
70
+ private volatile @ Nullable MessageChannel afterCommitChannel ;
67
71
68
- private volatile String afterCommitChannelName ;
72
+ private volatile @ Nullable String afterCommitChannelName ;
69
73
70
- private volatile MessageChannel afterRollbackChannel ;
74
+ private volatile @ Nullable MessageChannel afterRollbackChannel ;
71
75
72
- private volatile String afterRollbackChannelName ;
76
+ private volatile @ Nullable String afterRollbackChannelName ;
73
77
74
- private volatile DestinationResolver <MessageChannel > channelResolver ;
78
+ private volatile @ Nullable DestinationResolver <MessageChannel > channelResolver ;
75
79
76
80
@ Override
77
81
public void setBeanFactory (BeanFactory beanFactory ) throws BeansException {
@@ -108,7 +112,7 @@ public TransactionSynchronizationFactoryBean beforeCommit(MessageChannel message
108
112
return beforeCommit (this .beforeCommitExpression , messageChannel );
109
113
}
110
114
111
- public TransactionSynchronizationFactoryBean beforeCommit (String expression , MessageChannel messageChannel ) {
115
+ public TransactionSynchronizationFactoryBean beforeCommit (@ Nullable String expression , @ Nullable MessageChannel messageChannel ) {
112
116
Assert .state (StringUtils .hasText (expression ) || messageChannel != null ,
113
117
EXPRESSION_OR_CHANNEL_NEEDED );
114
118
this .beforeCommitExpression = expression ;
@@ -134,7 +138,7 @@ public TransactionSynchronizationFactoryBean afterCommit(MessageChannel messageC
134
138
return afterCommit (this .afterCommitExpression , messageChannel );
135
139
}
136
140
137
- public TransactionSynchronizationFactoryBean afterCommit (String expression , MessageChannel messageChannel ) {
141
+ public TransactionSynchronizationFactoryBean afterCommit (@ Nullable String expression , @ Nullable MessageChannel messageChannel ) {
138
142
Assert .state (StringUtils .hasText (expression ) || messageChannel != null ,
139
143
EXPRESSION_OR_CHANNEL_NEEDED );
140
144
this .afterCommitExpression = expression ;
@@ -160,7 +164,7 @@ public TransactionSynchronizationFactoryBean afterRollback(MessageChannel messag
160
164
return afterRollback (this .afterRollbackExpression , messageChannel );
161
165
}
162
166
163
- public TransactionSynchronizationFactoryBean afterRollback (String expression , MessageChannel messageChannel ) {
167
+ public TransactionSynchronizationFactoryBean afterRollback (@ Nullable String expression , @ Nullable MessageChannel messageChannel ) {
164
168
Assert .state (StringUtils .hasText (expression ) || messageChannel != null ,
165
169
EXPRESSION_OR_CHANNEL_NEEDED );
166
170
this .afterRollbackExpression = expression ;
0 commit comments