Class BeanFactorySessionFactoryLookup
java.lang.Object
org.springframework.data.cassandra.core.cql.session.lookup.BeanFactorySessionFactoryLookup
- All Implemented Interfaces:
Aware,BeanFactoryAware,SessionFactoryLookup
public class BeanFactorySessionFactoryLookup
extends Object
implements SessionFactoryLookup, BeanFactoryAware
SessionFactoryLookup implementation based on a Spring BeanFactory.
Will lookup Spring managed beans identified by bean name, expecting them to be of type SessionFactory.
- Since:
- 2.0
- Author:
- Mark Paluch
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance ofBeanFactorySessionFactoryLookup.BeanFactorySessionFactoryLookup(BeanFactory beanFactory) Create a new instance ofBeanFactorySessionFactoryLookupgivenBeanFactory. -
Method Summary
Modifier and TypeMethodDescriptiongetSessionFactory(String sessionFactoryName) Implementations must implement this method to retrieve theSessionFactoryidentified by the given name from their backing store.voidsetBeanFactory(BeanFactory beanFactory)
-
Constructor Details
-
BeanFactorySessionFactoryLookup
public BeanFactorySessionFactoryLookup()Create a new instance ofBeanFactorySessionFactoryLookup.The BeanFactory to access must be set via
setBeanFactory(BeanFactory).- See Also:
-
BeanFactorySessionFactoryLookup
Create a new instance ofBeanFactorySessionFactoryLookupgivenBeanFactory.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 (BeanFactoryAwarecontract). 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 lookupsession factories, must not be null.
-
-
Method Details
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware
-
getSessionFactory
public SessionFactory getSessionFactory(String sessionFactoryName) throws SessionFactoryLookupFailureException Description copied from interface:SessionFactoryLookupImplementations must implement this method to retrieve theSessionFactoryidentified by the given name from their backing store.- Specified by:
getSessionFactoryin interfaceSessionFactoryLookup- Parameters:
sessionFactoryName- the name of theSessionFactory.- Returns:
- the
SessionFactory(never null). - Throws:
SessionFactoryLookupFailureException- if the lookup failed.
-