Class JpaRepositoryFactoryBean<T extends org.springframework.data.repository.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>
org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean<T,S,ID>
Type Parameters:
T - the type of the repository
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, org.springframework.data.repository.core.support.RepositoryFactoryInformation<S,ID>
Direct Known Subclasses:
EnversRevisionRepositoryFactoryBean

public class JpaRepositoryFactoryBean<T extends org.springframework.data.repository.Repository<S,ID>,S,ID> extends org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport<T,S,ID>
Special adapter for Springs FactoryBean interface to allow easy setup of repository factories via Spring configuration.
Author:
Oliver Gierke, Eberhard Wolff, Mark Paluch, Jens Schauder, RĂ©da Housni Alaoui
  • Field Summary

    Fields inherited from interface org.springframework.beans.factory.FactoryBean

    OBJECT_TYPE_ATTRIBUTE
  • Constructor Summary

    Constructors
    Constructor
    Description
    JpaRepositoryFactoryBean(Class<? extends T> repositoryInterface)
    Creates a new JpaRepositoryFactoryBean for the given repository interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected org.springframework.data.repository.core.support.RepositoryFactorySupport
    createRepositoryFactory(jakarta.persistence.EntityManager entityManager)
    Returns a RepositoryFactorySupport.
    protected org.springframework.data.repository.core.support.RepositoryFactorySupport
     
    void
    setEntityManager(jakarta.persistence.EntityManager entityManager)
    The EntityManager to be used.
    void
    setEntityPathResolver(org.springframework.beans.factory.ObjectProvider<org.springframework.data.querydsl.EntityPathResolver> resolver)
    Configures the EntityPathResolver to be used.
    void
    setEscapeCharacter(char escapeCharacter)
     
    void
    setMappingContext(org.springframework.data.mapping.context.MappingContext<?,?> mappingContext)
     
    void
    Configures the JpaQueryMethodFactory to be used.

    Methods inherited from class org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport

    createRepositoryFactory, setBeanFactory, setEnableDefaultTransactions, setTransactionManager

    Methods inherited from class org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport

    addRepositoryFactoryCustomizer, createDefaultQueryMethodEvaluationContextProvider, getEntityInformation, getObject, getObjectType, getPersistentEntity, getQueryMethods, getRepositoryInformation, isSingleton, setApplicationEventPublisher, setBeanClassLoader, setCustomImplementation, setEvaluationContextProvider, setLazyInit, setNamedQueries, setQueryLookupStrategyKey, setRepositoryBaseClass, setRepositoryFragments

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JpaRepositoryFactoryBean

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

    • setEntityManager

      public void setEntityManager(jakarta.persistence.EntityManager entityManager)
      The EntityManager to be used.
      Parameters:
      entityManager - the entityManager to set
    • setMappingContext

      public void setMappingContext(org.springframework.data.mapping.context.MappingContext<?,?> mappingContext)
      Overrides:
      setMappingContext in class org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport<T extends org.springframework.data.repository.Repository<S,ID>,S,ID>
    • setEntityPathResolver

      @Autowired public void setEntityPathResolver(org.springframework.beans.factory.ObjectProvider<org.springframework.data.querydsl.EntityPathResolver> resolver)
      Configures the EntityPathResolver to be used. Will expect a canonical bean to be present but fallback to SimpleEntityPathResolver.INSTANCE in case none is available.
      Parameters:
      resolver - must not be null.
    • setQueryMethodFactory

      @Autowired public void setQueryMethodFactory(@Nullable JpaQueryMethodFactory factory)
      Configures the JpaQueryMethodFactory to be used. Will expect a canonical bean to be present but will fallback to DefaultJpaQueryMethodFactory in case none is available.
      Parameters:
      factory - may be null.
    • doCreateRepositoryFactory

      protected org.springframework.data.repository.core.support.RepositoryFactorySupport doCreateRepositoryFactory()
      Specified by:
      doCreateRepositoryFactory in class org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport<T extends org.springframework.data.repository.Repository<S,ID>,S,ID>
    • createRepositoryFactory

      protected org.springframework.data.repository.core.support.RepositoryFactorySupport createRepositoryFactory(jakarta.persistence.EntityManager entityManager)
      Returns a RepositoryFactorySupport.
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport<T extends org.springframework.data.repository.Repository<S,ID>,S,ID>
    • setEscapeCharacter

      public void setEscapeCharacter(char escapeCharacter)