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
,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 newJpaRepositoryFactoryBean
for the given repository interface. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected RepositoryFactorySupport
createRepositoryFactory
(jakarta.persistence.EntityManager entityManager) Returns aRepositoryFactorySupport
.protected RepositoryFactorySupport
void
setEntityManager
(jakarta.persistence.EntityManager entityManager) TheEntityManager
to be used.void
Configures theEntityPathResolver
to be used.void
setEscapeCharacter
(char escapeCharacter) void
setMappingContext
(MappingContext<?, ?> mappingContext) void
Configures theJpaQueryMethodFactory
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
-
Constructor Details
-
JpaRepositoryFactoryBean
Creates a newJpaRepositoryFactoryBean
for the given repository interface.- Parameters:
repositoryInterface
- must not be null.
-
-
Method Details
-
setEntityManager
public void setEntityManager(jakarta.persistence.EntityManager entityManager) TheEntityManager
to be used.- Parameters:
entityManager
- the entityManager to set
-
setMappingContext
- Overrides:
setMappingContext
in classRepositoryFactoryBeanSupport<T extends Repository<S,
ID>, S, ID>
-
setEntityPathResolver
Configures theEntityPathResolver
to be used. Will expect a canonical bean to be present but fallback toSimpleEntityPathResolver.INSTANCE
in case none is available.- Parameters:
resolver
- must not be null.
-
setQueryMethodFactory
Configures theJpaQueryMethodFactory
to be used. Will expect a canonical bean to be present but will fallback toDefaultJpaQueryMethodFactory
in case none is available.- Parameters:
factory
- may be null.
-
doCreateRepositoryFactory
- Specified by:
doCreateRepositoryFactory
in classTransactionalRepositoryFactoryBeanSupport<T extends Repository<S,
ID>, S, ID>
-
createRepositoryFactory
protected RepositoryFactorySupport createRepositoryFactory(jakarta.persistence.EntityManager entityManager) Returns aRepositoryFactorySupport
. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classRepositoryFactoryBeanSupport<T extends Repository<S,
ID>, S, ID>
-
setEscapeCharacter
public void setEscapeCharacter(char escapeCharacter)
-