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:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,FactoryBean<T>
,InitializingBean
,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
ConstructorDescriptionJpaRepositoryFactoryBean
(Class<? extends T> repositoryInterface) Creates a newJpaRepositoryFactoryBean
for the given repository interface. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected org.springframework.data.repository.core.support.RepositoryFactorySupport
createRepositoryFactory
(jakarta.persistence.EntityManager entityManager) Returns aRepositoryFactorySupport
.protected org.springframework.data.repository.core.support.RepositoryFactorySupport
void
setEntityManager
(jakarta.persistence.EntityManager entityManager) TheEntityManager
to be used.void
setEntityPathResolver
(ObjectProvider<org.springframework.data.querydsl.EntityPathResolver> resolver) Configures theEntityPathResolver
to be used.void
setEscapeCharacter
(char escapeCharacter) void
setMappingContext
(org.springframework.data.mapping.context.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
public void setMappingContext(org.springframework.data.mapping.context.MappingContext<?, ?> mappingContext) -
setEntityPathResolver
@Autowired public void setEntityPathResolver(ObjectProvider<org.springframework.data.querydsl.EntityPathResolver> resolver) 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
protected org.springframework.data.repository.core.support.RepositoryFactorySupport doCreateRepositoryFactory() -
createRepositoryFactory
protected org.springframework.data.repository.core.support.RepositoryFactorySupport createRepositoryFactory(jakarta.persistence.EntityManager entityManager) Returns aRepositoryFactorySupport
. -
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classorg.springframework.data.repository.core.support.RepositoryFactoryBeanSupport<T extends org.springframework.data.repository.Repository<S,
ID>, S, ID>
-
setEscapeCharacter
public void setEscapeCharacter(char escapeCharacter)
-