diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java index 85cd680ad8..f7fb0d40c0 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java +++ b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationManager.java @@ -297,6 +297,9 @@ public abstract class TransactionSynchronizationManager { if (synchs.isEmpty()) { return Collections.emptyList(); } + else if (synchs.size() == 1) { + return Collections.singletonList(synchs.iterator().next()); + } else { // Sort lazily here, not in registerSynchronization. List sortedSynchs = new ArrayList<>(synchs);