Class BeanFactoryConnectionFactoryLookup
java.lang.Object
org.springframework.r2dbc.connection.lookup.BeanFactoryConnectionFactoryLookup
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanFactoryAware,ConnectionFactoryLookup
public class BeanFactoryConnectionFactoryLookup
extends Object
implements ConnectionFactoryLookup, org.springframework.beans.factory.BeanFactoryAware
ConnectionFactoryLookup implementation based on a
Spring BeanFactory.
Will lookup Spring managed beans identified by bean name,
expecting them to be of type ConnectionFactory.
- Since:
- 5.3
- Author:
- Mark Paluch
- See Also:
-
BeanFactory
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of theBeanFactoryConnectionFactoryLookupclass.BeanFactoryConnectionFactoryLookup(org.springframework.beans.factory.BeanFactory beanFactory) Create a new instance of theBeanFactoryConnectionFactoryLookupclass. -
Method Summary
Modifier and TypeMethodDescriptiongetConnectionFactory(String connectionFactoryName) Retrieve theConnectionFactoryidentified by the given name.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
-
Constructor Details
-
BeanFactoryConnectionFactoryLookup
public BeanFactoryConnectionFactoryLookup()Create a new instance of theBeanFactoryConnectionFactoryLookupclass.The BeanFactory to access must be set via
setBeanFactory. -
BeanFactoryConnectionFactoryLookup
public BeanFactoryConnectionFactoryLookup(org.springframework.beans.factory.BeanFactory beanFactory) Create a new instance of theBeanFactoryConnectionFactoryLookupclass.Use of this constructor is redundant if this object is being created by a Spring IoC container, as the supplied
BeanFactorywill be replaced by theBeanFactorythat creates it (c.f. theBeanFactoryAwarecontract). So only use this constructor if you are using this class outside the context of a Spring IoC container.- Parameters:
beanFactory- the bean factory to be used to lookupConnectionFactories
-
-
Method Details
-
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
getConnectionFactory
public ConnectionFactory getConnectionFactory(String connectionFactoryName) throws ConnectionFactoryLookupFailureException Description copied from interface:ConnectionFactoryLookupRetrieve theConnectionFactoryidentified by the given name.- Specified by:
getConnectionFactoryin interfaceConnectionFactoryLookup- Parameters:
connectionFactoryName- the name of theConnectionFactory- Returns:
- the
ConnectionFactory(nevernull) - Throws:
ConnectionFactoryLookupFailureException- if the lookup failed
-