Document target method expectations for ReactiveTransactionManager
Closes gh-23277
This commit is contained in:
@@ -105,6 +105,11 @@ import org.springframework.transaction.TransactionDefinition;
|
||||
* all participating data access operations need to execute within the same
|
||||
* Reactor context in the same reactive pipeline.
|
||||
*
|
||||
* <p><b>Note: When configured with a {@code ReactiveTransactionManager}, all
|
||||
* transaction-demarcated methods are expected to return a reactive pipeline.</b>
|
||||
* Void methods or regular return types need to be associated with a regular
|
||||
* {@code PlatformTransactionManager}, e.g. through {@link #transactionManager()}.
|
||||
*
|
||||
* @author Colin Sampaleanu
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
|
||||
@@ -358,8 +358,8 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
(isSuspendingFunction ? (hasSuspendingFlowReturnType ? Flux.class : Mono.class) : method.getReturnType());
|
||||
ReactiveAdapter adapter = this.reactiveAdapterRegistry.getAdapter(reactiveType);
|
||||
if (adapter == null) {
|
||||
throw new IllegalStateException("Cannot apply reactive transaction to non-reactive return type: " +
|
||||
method.getReturnType());
|
||||
throw new IllegalStateException("Cannot apply reactive transaction to non-reactive return type [" +
|
||||
method.getReturnType() + "] with specified transaction manager: " + tm);
|
||||
}
|
||||
return new ReactiveTransactionSupport(adapter);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user