R2dbcTransactionManager
instead.@Deprecated public class R2dbcTransactionManager extends R2dbcTransactionManager implements InitializingBean
ReactiveTransactionManager
implementation for a single R2DBC
ConnectionFactory
. This class is capable of working in any environment with any R2DBC driver, as long as the
setup uses a ConnectionFactory
as its Connection
factory mechanism. Binds a R2DBC Connection
from the specified ConnectionFactory
to the current subscriber context, potentially allowing for one
context-bound Connection
per ConnectionFactory
.
Note: The ConnectionFactory
that this transaction manager operates on needs to return independent
Connection
s. The Connection
s may come from a pool (the typical case), but the
ConnectionFactory
must not return scoped scoped Connection
s or the like. This transaction manager
will associate Connection
with context-bound transactions itself, according to the specified propagation
behavior. It assumes that a separate, independent Connection
can be obtained even during an ongoing
transaction.
Application code is required to retrieve the R2DBC Connection via
ConnectionFactoryUtils.getConnection(ConnectionFactory)
instead of a standard R2DBC-style
ConnectionFactory.create()
call. Spring classes such as DatabaseClient
use this strategy implicitly.
If not used in combination with this transaction manager, the ConnectionFactoryUtils
lookup strategy behaves
exactly like the native ConnectionFactory
lookup; it can thus be used in a portable fashion.
Alternatively, you can allow application code to work with the standard R2DBC lookup pattern
ConnectionFactory.create()
, for example for code that is not aware of Spring at all. In that case, define a
TransactionAwareConnectionFactoryProxy
for your target ConnectionFactory
, and pass that proxy
ConnectionFactory
to your DAOs, which will automatically participate in Spring-managed transactions when
accessing it.
This transaction manager triggers flush callbacks on registered transaction synchronizations (if synchronization is
generally active), assuming resources operating on the underlying R2DBC Connection
.
AbstractReactiveTransactionManager.SuspendedResourcesHolder
logger
Constructor and Description |
---|
R2dbcTransactionManager()
Deprecated.
Create a new @link ConnectionFactoryTransactionManager} instance.
|
R2dbcTransactionManager(ConnectionFactory connectionFactory)
Deprecated.
Create a new
R2dbcTransactionManager instance. |
afterPropertiesSet, determineTimeout, doBegin, doCleanupAfterCompletion, doCommit, doGetTransaction, doResume, doRollback, doSetRollbackOnly, doSuspend, getConnectionFactory, isEnforceReadOnly, isExistingTransaction, obtainConnectionFactory, prepareTransactionalConnection, resolveIsolationLevel, setConnectionFactory, setEnforceReadOnly, translateException
commit, getReactiveTransaction, prepareForCommit, registerAfterCompletionWithExistingTransaction, rollback
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterPropertiesSet
public R2dbcTransactionManager()
public R2dbcTransactionManager(ConnectionFactory connectionFactory)
R2dbcTransactionManager
instance.connectionFactory
- the R2DBC ConnectionFactory to manage transactions forCopyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.