T - the type of the repositorypublic abstract class RepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID> extends Object implements InitializingBean, RepositoryFactoryInformation<S,ID>, FactoryBean<T>, BeanClassLoaderAware, BeanFactoryAware, ApplicationEventPublisherAware
FactoryBean interface to allow easy setup of repository factories via Spring
configuration.OBJECT_TYPE_ATTRIBUTE| Modifier | Constructor and Description |
|---|---|
protected |
RepositoryFactoryBeanSupport(Class<? extends T> repositoryInterface)
Creates a new
RepositoryFactoryBeanSupport for the given repository interface. |
| Modifier and Type | Method and Description |
|---|---|
void |
addRepositoryFactoryCustomizer(RepositoryFactoryCustomizer customizer)
Register a
RepositoryFactoryCustomizer to customize the repository factor
before creating the repository. |
void |
afterPropertiesSet() |
protected Optional<QueryMethodEvaluationContextProvider> |
createDefaultQueryMethodEvaluationContextProvider(ListableBeanFactory beanFactory)
Create a default
QueryMethodEvaluationContextProvider (or subclass) from ListableBeanFactory. |
protected abstract RepositoryFactorySupport |
createRepositoryFactory()
Create the actual
RepositoryFactorySupport instance. |
EntityInformation<S,ID> |
getEntityInformation()
Returns
EntityInformation the repository factory is using. |
T |
getObject() |
Class<? extends T> |
getObjectType() |
PersistentEntity<?,?> |
getPersistentEntity()
Returns the
PersistentEntity managed by the underlying repository. |
List<QueryMethod> |
getQueryMethods()
Returns all
QueryMethods declared for that repository. |
RepositoryInformation |
getRepositoryInformation()
Returns the
RepositoryInformation to determine meta-information about the repository being used. |
boolean |
isSingleton() |
void |
setApplicationEventPublisher(ApplicationEventPublisher publisher) |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setCustomImplementation(Object customImplementation)
Setter to inject a custom repository implementation.
|
void |
setEvaluationContextProvider(QueryMethodEvaluationContextProvider evaluationContextProvider)
Sets the
QueryMethodEvaluationContextProvider to be used to evaluate SpEL expressions in manually defined
queries. |
void |
setLazyInit(boolean lazy)
Configures whether to initialize the repository proxy lazily.
|
protected void |
setMappingContext(MappingContext<?,?> mappingContext)
Configures the
MappingContext to be used to lookup PersistentEntity instances for
getPersistentEntity(). |
void |
setNamedQueries(NamedQueries namedQueries)
Setter to inject a
NamedQueries instance. |
void |
setQueryLookupStrategyKey(QueryLookupStrategy.Key queryLookupStrategyKey)
Set the
QueryLookupStrategy.Key to be used. |
void |
setRepositoryBaseClass(Class<?> repositoryBaseClass)
Configures the repository base class to be used.
|
void |
setRepositoryFragments(RepositoryComposition.RepositoryFragments repositoryFragments)
Setter to inject repository fragments.
|
protected RepositoryFactoryBeanSupport(Class<? extends T> repositoryInterface)
RepositoryFactoryBeanSupport for the given repository interface.repositoryInterface - must not be null.public void setRepositoryBaseClass(Class<?> repositoryBaseClass)
repositoryBaseClass - the repositoryBaseClass to set, can be null.public void setQueryLookupStrategyKey(QueryLookupStrategy.Key queryLookupStrategyKey)
QueryLookupStrategy.Key to be used.queryLookupStrategyKey - public void setCustomImplementation(Object customImplementation)
customImplementation - public void setRepositoryFragments(RepositoryComposition.RepositoryFragments repositoryFragments)
repositoryFragments - public void setNamedQueries(NamedQueries namedQueries)
NamedQueries instance.namedQueries - the namedQueries to setprotected void setMappingContext(MappingContext<?,?> mappingContext)
MappingContext to be used to lookup PersistentEntity instances for
getPersistentEntity().mappingContext - public void setEvaluationContextProvider(QueryMethodEvaluationContextProvider evaluationContextProvider)
QueryMethodEvaluationContextProvider to be used to evaluate SpEL expressions in manually defined
queries.evaluationContextProvider - must not be null.public void addRepositoryFactoryCustomizer(RepositoryFactoryCustomizer customizer)
RepositoryFactoryCustomizer to customize the repository factor
before creating the repository.customizer - must not be null.public void setLazyInit(boolean lazy)
lazy - whether to initialize the repository proxy lazily. This defaults to false.public void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader in interface BeanClassLoaderAwarepublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory in interface BeanFactoryAwareBeansExceptionprotected Optional<QueryMethodEvaluationContextProvider> createDefaultQueryMethodEvaluationContextProvider(ListableBeanFactory beanFactory)
QueryMethodEvaluationContextProvider (or subclass) from ListableBeanFactory.beanFactory - the bean factory to use.Optional.empty().public void setApplicationEventPublisher(ApplicationEventPublisher publisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAwarepublic EntityInformation<S,ID> getEntityInformation()
RepositoryFactoryInformationEntityInformation the repository factory is using.getEntityInformation in interface RepositoryFactoryInformation<S,ID>public RepositoryInformation getRepositoryInformation()
RepositoryFactoryInformationRepositoryInformation to determine meta-information about the repository being used.getRepositoryInformation in interface RepositoryFactoryInformation<S,ID>public PersistentEntity<?,?> getPersistentEntity()
RepositoryFactoryInformationPersistentEntity managed by the underlying repository. Can be null in case the
underlying persistence mechanism does not expose a MappingContext.getPersistentEntity in interface RepositoryFactoryInformation<S,ID>public List<QueryMethod> getQueryMethods()
RepositoryFactoryInformationQueryMethods declared for that repository.getQueryMethods in interface RepositoryFactoryInformation<S,ID>@Nonnull public T getObject()
getObject in interface FactoryBean<T extends Repository<S,ID>>@Nonnull public Class<? extends T> getObjectType()
getObjectType in interface FactoryBean<T extends Repository<S,ID>>public boolean isSingleton()
isSingleton in interface FactoryBean<T extends Repository<S,ID>>public void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanprotected abstract RepositoryFactorySupport createRepositoryFactory()
RepositoryFactorySupport instance.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.