Class TransactionalRepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID>
java.lang.Object
org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport<T,S,ID>
org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport<T,S,ID>
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,FactoryBean<T>,InitializingBean,ApplicationEventPublisherAware,EnvironmentAware,RepositoryFactoryInformation<S,ID>
public abstract class TransactionalRepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID>
extends RepositoryFactoryBeanSupport<T,S,ID>
implements BeanFactoryAware
Extension of
RepositoryFactoryBeanSupport to add transactional capabilities to the repository proxy. Will
register a TransactionalRepositoryProxyPostProcessor that in turn adds a TransactionInterceptor to
the repository proxy to be created.- Author:
- Oliver Gierke
-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransactionalRepositoryFactoryBeanSupport(Class<? extends T> repositoryInterface) Creates a newTransactionalRepositoryFactoryBeanSupportfor the given repository interface. -
Method Summary
Modifier and TypeMethodDescriptionprotected final RepositoryFactorySupportDelegatesRepositoryFactorySupportcreation todoCreateRepositoryFactory()and applies theTransactionalRepositoryProxyPostProcessorto the created instance.protected abstract RepositoryFactorySupportCreates the actualRepositoryFactorySupportinstance.voidsetBeanFactory(BeanFactory beanFactory) voidsetEnableDefaultTransactions(boolean enableDefaultTransactions) Configures whether to enable the default transactions configured at the repository base implementation class.voidsetTransactionManager(String transactionManager) Setter to configure which transaction manager to be used.Methods inherited from class org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport
addRepositoryFactoryCustomizer, afterPropertiesSet, createDefaultEvaluationContextProvider, createDefaultQueryMethodEvaluationContextProvider, getEntityInformation, getObject, getObjectType, getPersistentEntity, getQueryMethods, getRepositoryInformation, isSingleton, setApplicationEventPublisher, setBeanClassLoader, setCustomImplementation, setEnvironment, setEvaluationContextProvider, setEvaluationContextProvider, setExposeMetadata, setLazyInit, setMappingContext, setNamedQueries, setQueryLookupStrategyKey, setRepositoryBaseClass, setRepositoryFragments
-
Constructor Details
-
TransactionalRepositoryFactoryBeanSupport
Creates a newTransactionalRepositoryFactoryBeanSupportfor the given repository interface.- Parameters:
repositoryInterface- must not be null.
-
-
Method Details
-
setTransactionManager
Setter to configure which transaction manager to be used. We have to use the bean name explicitly as otherwise the qualifier of theTransactionalannotation is used. By explicitly defining the transaction manager bean name we favour let this one be the default one chosen.- Parameters:
transactionManager-
-
setEnableDefaultTransactions
public void setEnableDefaultTransactions(boolean enableDefaultTransactions) Configures whether to enable the default transactions configured at the repository base implementation class.- Parameters:
enableDefaultTransactions- the enableDefaultTransactions to set
-
createRepositoryFactory
DelegatesRepositoryFactorySupportcreation todoCreateRepositoryFactory()and applies theTransactionalRepositoryProxyPostProcessorto the created instance.- Specified by:
createRepositoryFactoryin classRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID> - Returns:
- See Also:
-
doCreateRepositoryFactory
Creates the actualRepositoryFactorySupportinstance.- Returns:
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Overrides:
setBeanFactoryin classRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID>
-