Top Description Fields Constructors Methods
org.springframework.r2dbc.connection.lookup

public Class BeanFactoryConnectionFactoryLookup

extends Object
implements ConnectionFactoryLookup, BeanFactoryAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.Aware, org.springframework.r2dbc.connection.lookup.ConnectionFactoryLookup
Imports
io.r2dbc.spi.ConnectionFactory, org.springframework.beans.BeansException, org.springframework.beans.factory.BeanFactory, .BeanFactoryAware, org.springframework.lang.Nullable, org.springframework.util.Assert

ConnectionFactoryLookup implementation based on a Spring BeanFactory.

Will lookup Spring managed beans identified by bean name, expecting them to be of type ConnectionFactory.

Author
Mark Paluch
Since
5.3
See Also
BeanFactory

Field Summary

Modifier and TypeField and Description
private BeanFactory

Constructor Summary

AccessConstructor and Description
public
public
BeanFactoryConnectionFactoryLookup(BeanFactory
the bean factory to be used to lookup ConnectionFactories
beanFactory
)

Create a new instance of the BeanFactoryConnectionFactoryLookup class.

Method Summary

Modifier and TypeMethod and Description
public ConnectionFactory
public void
setBeanFactory(BeanFactory
owning BeanFactory (never null). The bean can immediately call methods on the factory.
beanFactory
)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Callback that supplies the owning factory to a bean instance.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beanFactoryback to summary
private BeanFactory beanFactory
Annotations
@Nullable

Constructor Detail

BeanFactoryConnectionFactoryLookupback to summary
public BeanFactoryConnectionFactoryLookup()

Create a new instance of the BeanFactoryConnectionFactoryLookup class.

The BeanFactory to access must be set via setBeanFactory.

See Also
setBeanFactory
BeanFactoryConnectionFactoryLookupback to summary
public BeanFactoryConnectionFactoryLookup(BeanFactory beanFactory)

Create a new instance of the BeanFactoryConnectionFactoryLookup class.

Use of this constructor is redundant if this object is being created by a Spring IoC container, as the supplied BeanFactory will be replaced by the BeanFactory that creates it (c.f. the BeanFactoryAware contract). So only use this constructor if you are using this class outside the context of a Spring IoC container.

Parameters
beanFactory:BeanFactory

the bean factory to be used to lookup ConnectionFactories

Method Detail

getConnectionFactoryback to summary
public ConnectionFactory getConnectionFactory(String connectionFactoryName) throws ConnectionFactoryLookupFailureException

Implements org.springframework.r2dbc.connection.lookup.ConnectionFactoryLookup.getConnectionFactory.

Doc from org.springframework.r2dbc.connection.lookup.ConnectionFactoryLookup.getConnectionFactory.

Retrieve the ConnectionFactory identified by the given name.

Parameters
connectionFactoryName:String

the name of the ConnectionFactory

Returns:ConnectionFactory

the ConnectionFactory (never null)

Annotations
@Override
Exceptions
ConnectionFactoryLookupFailureException:
if the lookup failed
setBeanFactoryback to summary
public void setBeanFactory(BeanFactory beanFactory)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Doc from org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Callback that supplies the owning factory to a bean instance.

Invoked after the population of normal bean properties but before an initialization callback such as InitializingBean#afterPropertiesSet() or a custom init-method.

Parameters
beanFactory:BeanFactory

owning BeanFactory (never null). The bean can immediately call methods on the factory.

Annotations
@Override