Skip to content

Commit 622bb7f

Browse files
committed
Combine cases
1 parent 9eca25f commit 622bb7f

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

spring-tx/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,26 +171,18 @@ protected TransactionAttribute computeTransactionAttribute(Method method, @Nulla
171171
// If the target class is null, the method will be unchanged.
172172
Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass);
173173

174-
// First try is the method in the target class.
174+
// First try is the method in the declaring class.
175175
TransactionAttribute txAttr = findTransactionAttribute(specificMethod);
176176
if (txAttr != null) {
177177
return txAttr;
178178
}
179179

180-
// Second try is the transaction attribute on the declaring class.
181-
txAttr = findTransactionAttribute(specificMethod.getDeclaringClass());
180+
// Second try is the transaction attribute on the target class.
181+
txAttr = findTransactionAttribute(targetClass != null ? targetClass : specificMethod.getDeclaringClass());
182182
if (txAttr != null && ClassUtils.isUserLevelMethod(method)) {
183183
return txAttr;
184184
}
185185

186-
// Third try is the transaction attribute on the target class.
187-
if (targetClass != null) {
188-
txAttr = findTransactionAttribute(targetClass);
189-
if (txAttr != null && ClassUtils.isUserLevelMethod(method)) {
190-
return txAttr;
191-
}
192-
}
193-
194186
if (specificMethod != method) {
195187
// Fallback is to look at the original method.
196188
txAttr = findTransactionAttribute(method);

0 commit comments

Comments
 (0)