Skip to content

Commit

Permalink
Combine cases
Browse files Browse the repository at this point in the history
  • Loading branch information
markusheiden committed Mar 19, 2024
1 parent 9eca25f commit 622bb7f
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,26 +171,18 @@ protected TransactionAttribute computeTransactionAttribute(Method method, @Nulla
// If the target class is null, the method will be unchanged.
Method specificMethod = AopUtils.getMostSpecificMethod(method, targetClass);

// First try is the method in the target class.
// First try is the method in the declaring class.
TransactionAttribute txAttr = findTransactionAttribute(specificMethod);
if (txAttr != null) {
return txAttr;
}

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

// Third try is the transaction attribute on the target class.
if (targetClass != null) {
txAttr = findTransactionAttribute(targetClass);
if (txAttr != null && ClassUtils.isUserLevelMethod(method)) {
return txAttr;
}
}

if (specificMethod != method) {
// Fallback is to look at the original method.
txAttr = findTransactionAttribute(method);
Expand Down

0 comments on commit 622bb7f

Please sign in to comment.