Class JpaRepositoryFactoryBean<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>
org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean<T,S,ID>
- Type Parameters:
T- the type of the repository
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,FactoryBean<T>,InitializingBean,ApplicationEventPublisherAware,EnvironmentAware,RepositoryFactoryInformation<S,ID>
- Direct Known Subclasses:
EnversRevisionRepositoryFactoryBean
public class JpaRepositoryFactoryBean<T extends Repository<S,ID>,S,ID>
extends 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
ConstructorsConstructorDescriptionJpaRepositoryFactoryBean(Class<? extends T> repositoryInterface) Creates a newJpaRepositoryFactoryBeanfor the given repository interface. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected RepositoryFactorySupportcreateRepositoryFactory(jakarta.persistence.EntityManager entityManager) Returns aRepositoryFactorySupport.protected RepositoryFactorySupportvoidsetEntityManager(jakarta.persistence.EntityManager entityManager) TheEntityManagerto be used.voidConfigures theEntityPathResolverto be used.voidsetEscapeCharacter(char escapeCharacter) voidsetMappingContext(MappingContext<?, ?> mappingContext) voidConfigures theJpaQueryMethodFactoryto be used.Methods inherited from class org.springframework.data.repository.core.support.TransactionalRepositoryFactoryBeanSupport
createRepositoryFactory, setBeanFactory, setEnableDefaultTransactions, setTransactionManagerMethods inherited from class org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport
addRepositoryFactoryCustomizer, createDefaultEvaluationContextProvider, createDefaultQueryMethodEvaluationContextProvider, getEntityInformation, getObject, getObjectType, getPersistentEntity, getQueryMethods, getRepositoryInformation, isSingleton, setApplicationEventPublisher, setBeanClassLoader, setCustomImplementation, setEnvironment, setEvaluationContextProvider, setEvaluationContextProvider, setExposeMetadata, setLazyInit, setNamedQueries, setQueryLookupStrategyKey, setRepositoryBaseClass, setRepositoryFragments
-
Constructor Details
-
JpaRepositoryFactoryBean
Creates a newJpaRepositoryFactoryBeanfor the given repository interface.- Parameters:
repositoryInterface- must not be null.
-
-
Method Details
-
setEntityManager
public void setEntityManager(jakarta.persistence.EntityManager entityManager) TheEntityManagerto be used.- Parameters:
entityManager- the entityManager to set
-
setMappingContext
- Overrides:
setMappingContextin classRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID>
-
setEntityPathResolver
Configures theEntityPathResolverto be used. Will expect a canonical bean to be present but fallback toSimpleEntityPathResolver.INSTANCEin case none is available.- Parameters:
resolver- must not be null.
-
setQueryMethodFactory
Configures theJpaQueryMethodFactoryto be used. Will expect a canonical bean to be present but will fallback toDefaultJpaQueryMethodFactoryin case none is available.- Parameters:
factory- may be null.
-
doCreateRepositoryFactory
- Specified by:
doCreateRepositoryFactoryin classTransactionalRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID>
-
createRepositoryFactory
protected RepositoryFactorySupport createRepositoryFactory(jakarta.persistence.EntityManager entityManager) Returns aRepositoryFactorySupport. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID>
-
setEscapeCharacter
public void setEscapeCharacter(char escapeCharacter)
-