@Deprecated public class TransactionAwareConnectionFactoryProxy extends DelegatingConnectionFactory
ConnectionFactory, adding awareness of Spring-managed transactions.
Data access code that should remain unaware of Spring's data access support can work with this proxy to seamlessly
participate in Spring-managed transactions. Note that the transaction manager, for example
R2dbcTransactionManager, still needs to work with the underlying
ConnectionFactory, not with
Make sure that
TransactionAwareConnectionFactoryProxy is the outermost
ConnectionFactory of a
TransactionAwareConnectionFactoryProxy can delegate
either directly to the target connection pool or to some intermediary proxy/adapter.
ConnectionFactoryUtils for automatically participating in thread-bound transactions, for example
create() calls and
close calls on returned
Connection will behave properly within a transaction, i.e. always operate on the transactional Connection. If
not within a transaction, normal
ConnectionFactory behavior applies.
This proxy allows data access code to work with the plain R2DBC API. However, if possible, use Spring's
DatabaseClient to get transaction participation even without a proxy for
ConnectionFactory, avoiding the need to define such a proxy in the first place.
ConnectionFactory proxy needs to return wrapped
Connections (which implement the
ConnectionProxy interface) in order to handle close calls properly. Use
Wrapped.unwrap() to retrieve
the native R2DBC Connection.
|Constructor and Description|
Create a new
|Modifier and Type||Method and Description|
Wraps the given
getMetadata, getTargetConnectionFactory, obtainTargetConnectionFactory, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public TransactionAwareConnectionFactoryProxy(ConnectionFactory targetConnectionFactory)
targetConnectionFactory- the target
IllegalArgumentException- if given
public reactor.core.publisher.Mono<Connection> create()
ConnectionFactoryUtilsfor automatically participating in Spring-managed transactions.
ConnectionFactory handle implements the
ConnectionProxy interface, allowing to
retrieve the underlying target
Connectionif any, a new one else.
protected reactor.core.publisher.Mono<Connection> getTransactionAwareConnectionProxy(ConnectionFactory targetConnectionFactory)
Connectionwith a proxy that delegates every method call to it but delegates
Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.