Skip to content

Commit 0188270

Browse files
committed
Clarify transaction metadata exposed from currentTransactionStatus()
Closes gh-32310
1 parent 9430b24 commit 0188270

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -153,8 +153,15 @@ protected static TransactionInfo currentTransactionInfo() throws NoTransactionEx
153153
* Return the transaction status of the current method invocation.
154154
* Mainly intended for code that wants to set the current transaction
155155
* rollback-only but not throw an application exception.
156+
* <p>This exposes the locally declared transaction boundary with its declared name
157+
* and characteristics, as managed by the aspect. Ar runtime, the local boundary may
158+
* participate in an outer transaction: If you need transaction metadata from such
159+
* an outer transaction (the actual resource transaction) instead, consider using
160+
* {@link org.springframework.transaction.support.TransactionSynchronizationManager}.
156161
* @throws NoTransactionException if the transaction info cannot be found,
157162
* because the method was invoked outside an AOP invocation context
163+
* @see org.springframework.transaction.support.TransactionSynchronizationManager#getCurrentTransactionName()
164+
* @see org.springframework.transaction.support.TransactionSynchronizationManager#isCurrentTransactionReadOnly()
158165
*/
159166
public static TransactionStatus currentTransactionStatus() throws NoTransactionException {
160167
TransactionInfo info = currentTransactionInfo();

0 commit comments

Comments
 (0)