Class JdbcRepositoryFactoryBean<T extends Repository<S,ID> , S, ID extends Serializable>
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.jdbc.repository.support.JdbcRepositoryFactoryBean<T,S,ID>
- All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, FactoryBean<T>, InitializingBean, ApplicationEventPublisherAware, EnvironmentAware, RepositoryFactoryInformation<S,ID>
public class JdbcRepositoryFactoryBean<T extends Repository<S,ID>, S, ID extends Serializable>
extends TransactionalRepositoryFactoryBeanSupport<T,S,ID>
implements ApplicationEventPublisherAware
Special adapter for Springs
FactoryBean interface to allow easy setup of
repository factories via Spring configuration. Ideally, the factory bean is configured by providing a
JdbcAggregateOperations, BeanFactory, and ApplicationEventPublisher instance to avoid partial
configuration.
A partially populated factory bean can use BeanFactory to resolve missing dependencies, specifically:
- The
MappingContextis being derived fromRelationalMappingContextif themappingContextwas not set. - The
NamedParameterJdbcOperationsis looked up from aBeanFactoryifjdbcOperationswas not set. - The
QueryMappingConfigurationis looked up from aBeanFactoryifqueryMappingConfigurationwas not set. If theBeanFactorywas not set, defaults toQueryMappingConfiguration.EMPTY. - The
DataAccessStrategyis looked up from aBeanFactoryifdataAccessStrategywas not set. If theBeanFactorywas not set, then it is created usingDialect.
- Author:
- Jens Schauder, Greg Turnquist, Christoph Strobl, Oliver Gierke, Mark Paluch, Hebert Coelho, Chirag Tailor, Mikhail Polivakha, Sergey Korotaev, Tomohiko Ozawa
-
Nested Class Summary
Nested classes/interfaces inherited from class RepositoryFactoryBeanSupport
RepositoryFactoryBeanSupport.FragmentCreationContext, RepositoryFactoryBeanSupport.RepositoryFragmentsFunction -
Field Summary
Fields inherited from interface FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionJdbcRepositoryFactoryBean(Class<? extends T> repositoryInterface) Creates a newJdbcRepositoryFactoryBeanfor the given repository interface. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected RepositoryFactorySupportCreates the actualRepositoryFactorySupportinstance.voidvoidsetBeanFactory(BeanFactory beanFactory) voidsetConverter(JdbcConverter converter) voidsetDataAccessStrategy(DataAccessStrategy dataAccessStrategy) voidsetDialect(Dialect dialect) voidsetJdbcAggregateOperations(JdbcAggregateOperations jdbcAggregateOperations) Set theJdbcAggregateOperationsto use for this factory bean.voidsetJdbcOperations(NamedParameterJdbcOperations operations) voidsetMappingContext(RelationalMappingContext mappingContext) voidsetQueryMappingConfiguration(QueryMappingConfiguration queryMappingConfiguration) Methods inherited from class TransactionalRepositoryFactoryBeanSupport
createRepositoryFactory, setEnableDefaultTransactions, setTransactionManagerMethods inherited from class RepositoryFactoryBeanSupport
addRepositoryFactoryCustomizer, createDefaultEvaluationContextProvider, getEntityInformation, getObject, getObjectType, getPersistentEntity, getQueryMethods, getRepositoryFragmentsContributor, getRepositoryInformation, setBeanClassLoader, setCustomImplementation, setEnvironment, setEvaluationContextProvider, setExposeMetadata, setLazyInit, setMappingContext, setNamedQueries, setQueryLookupStrategyKey, setRepositoryBaseClass, setRepositoryFragments, setRepositoryFragmentsFunctionMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FactoryBean
isSingleton
-
Constructor Details
-
JdbcRepositoryFactoryBean
Creates a newJdbcRepositoryFactoryBeanfor the given repository interface.- Parameters:
repositoryInterface- must not be null.
-
-
Method Details
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware- Overrides:
setApplicationEventPublisherin classRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID extends Serializable>
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Overrides:
setBeanFactoryin classTransactionalRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID extends Serializable>
-
setJdbcAggregateOperations
Set theJdbcAggregateOperationsto use for this factory bean.- Parameters:
jdbcAggregateOperations-- Since:
- 4.0
-
setJdbcOperations
-
setConverter
-
setDialect
-
setDataAccessStrategy
- Parameters:
dataAccessStrategy- can be null.
-
setMappingContext
-
setQueryMappingConfiguration
- Parameters:
queryMappingConfiguration- can be null.afterPropertiesSet()defaults toQueryMappingConfiguration.EMPTYif null.
-
doCreateRepositoryFactory
Creates the actualRepositoryFactorySupportinstance.- Specified by:
doCreateRepositoryFactoryin classTransactionalRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID extends Serializable>
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classRepositoryFactoryBeanSupport<T extends Repository<S,ID>, S, ID extends Serializable>
-