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
ConstructorDescriptionCreate a new instance ofBeanFactorySessionFactoryLookup
.BeanFactorySessionFactoryLookup
(BeanFactory beanFactory) Create a new instance ofBeanFactorySessionFactoryLookup
givenBeanFactory
. -
Method Summary
Modifier and TypeMethodDescriptiongetSessionFactory
(String sessionFactoryName) Implementations must implement this method to retrieve theSessionFactory
identified by the given name from their backing store.void
setBeanFactory
(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 ofBeanFactorySessionFactoryLookup
givenBeanFactory
.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 theBeanFactory
that creates it (BeanFactoryAware
contract). 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:
setBeanFactory
in interfaceBeanFactoryAware
-
getSessionFactory
public SessionFactory getSessionFactory(String sessionFactoryName) throws SessionFactoryLookupFailureException Description copied from interface:SessionFactoryLookup
Implementations must implement this method to retrieve theSessionFactory
identified by the given name from their backing store.- Specified by:
getSessionFactory
in interfaceSessionFactoryLookup
- Parameters:
sessionFactoryName
- the name of theSessionFactory
.- Returns:
- the
SessionFactory
(never null). - Throws:
SessionFactoryLookupFailureException
- if the lookup failed.
-