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:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, RepositoryFactoryInformation<S,ID>

public abstract class TransactionalRepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID> extends RepositoryFactoryBeanSupport<T,S,ID> implements org.springframework.beans.factory.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
  • Constructor Details

    • TransactionalRepositoryFactoryBeanSupport

      protected TransactionalRepositoryFactoryBeanSupport(Class<? extends T> repositoryInterface)
      Creates a new TransactionalRepositoryFactoryBeanSupport for the given repository interface.
      Parameters:
      repositoryInterface - must not be null.
  • Method Details

    • setTransactionManager

      public void setTransactionManager(String transactionManager)
      Setter to configure which transaction manager to be used. We have to use the bean name explicitly as otherwise the qualifier of the Transactional annotation 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

      protected final RepositoryFactorySupport createRepositoryFactory()
      Delegates RepositoryFactorySupport creation to doCreateRepositoryFactory() and applies the TransactionalRepositoryProxyPostProcessor to the created instance.
      Specified by:
      createRepositoryFactory in class RepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID>
      Returns:
      See Also:
    • doCreateRepositoryFactory

      protected abstract RepositoryFactorySupport doCreateRepositoryFactory()
      Creates the actual RepositoryFactorySupport instance.
      Returns:
    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Overrides:
      setBeanFactory in class RepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID>