Class BeanfactoryConnectionfactoryLookup
java.lang.Object
org.springframework.r2dbc.connection.lookup.BeanfactoryConnectionfactoryLookup
- All Implemented Interfaces:
Aware, BeanfactoryAware, ConnectionfactoryLookup
public class BeanfactoryConnectionfactoryLookup
extends Object
implements ConnectionfactoryLookup, 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:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance of theBeanfactoryConnectionfactoryLookupclass.BeanfactoryConnectionfactoryLookup(Beanfactory beanfactory) Create a new instance of theBeanfactoryConnectionfactoryLookupclass. -
Method Summary
Modifier and TypeMethodDescriptiongetConnectionfactory(String connectionfactoryName) Retrieve theConnectionfactoryidentified by the given name.voidsetBeanfactory(Beanfactory beanfactory) Callback that supplies the owning factory to a bean instance.
-
Constructor Details
-
BeanfactoryConnectionfactoryLookup
public BeanfactoryConnectionfactoryLookup()Create a new instance of theBeanfactoryConnectionfactoryLookupclass.The Beanfactory to access must be set via
setBeanfactory.- See Also:
-
BeanfactoryConnectionfactoryLookup
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
Description copied from interface:BeanfactoryAwareCallback 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.- Specified by:
setBeanfactoryin interfaceBeanfactoryAware- Parameters:
beanfactory- owning Beanfactory (nevernull). The bean can immediately call methods on the factory.- See Also:
-
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
-