Class JpaBaseConfiguration
- java.lang.Object
- org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
@Configuration @EnableConfigurationProperties(JpaProperties.class) @Import(org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.Registrar.class) public abstract class JpaBaseConfiguration extends Object implements org.springframework.beans.factory.BeanFactoryAware
BaseAuto-configuration
for JPA.
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
JpaBaseConfiguration.JpaWebConfiguration
Constructor Summary
Constructors Modifier Constructor Description protected
JpaBaseConfiguration(DataSource dataSource, JpaProperties properties, org.springframework.beans.factory.ObjectProvider<org.springframework.transaction.jta.JtaTransactionManager> jtaTransactionManager, org.springframework.beans.factory.ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers)
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter
createJpaVendorAdapter()
protected void
customizeVendorProperties(Map<String,Object> vendorProperties)
Customize vendor properties before they are used.org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
entityManagerFactory(org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder factoryBuilder)
org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder
entityManagerFactoryBuilder(org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter, org.springframework.beans.factory.ObjectProvider<org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager> persistenceUnitManager, org.springframework.beans.factory.ObjectProvider<EntityManagerFactoryBuilderCustomizer> customizers)
protected DataSource
getDataSource()
Return theDataSource
.protected org.springframework.transaction.jta.JtaTransactionManager
getJtaTransactionManager()
Return the JTA transaction manager.protected String[]
getPackagesToScan()
protected JpaProperties
getProperties()
Return theJpaProperties
.protected abstract Map<String,Object>
getVendorProperties()
protected boolean
isJta()
Returns if a JTAPlatformTransactionManager
is being used.org.springframework.orm.jpa.JpaVendorAdapter
jpaVendorAdapter()
void
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
org.springframework.transaction.PlatformTransactionManager
transactionManager()
Constructor Detail
JpaBaseConfiguration
protected JpaBaseConfiguration(DataSource dataSource, JpaProperties properties, org.springframework.beans.factory.ObjectProvider<org.springframework.transaction.jta.JtaTransactionManager> jtaTransactionManager, org.springframework.beans.factory.ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers)
Method Detail
transactionManager
@Bean @ConditionalOnMissingBean public org.springframework.transaction.PlatformTransactionManager transactionManager()
jpaVendorAdapter
@Bean @ConditionalOnMissingBean public org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter()
entityManagerFactoryBuilder
@Bean @ConditionalOnMissingBean public org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder entityManagerFactoryBuilder(org.springframework.orm.jpa.JpaVendorAdapter jpaVendorAdapter, org.springframework.beans.factory.ObjectProvider<org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager> persistenceUnitManager, org.springframework.beans.factory.ObjectProvider<EntityManagerFactoryBuilderCustomizer> customizers)
entityManagerFactory
@Bean @Primary @ConditionalOnMissingBean({org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.class,javax.persistence.EntityManagerFactory.class}) public org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean entityManagerFactory(org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder factoryBuilder)
createJpaVendorAdapter
protected abstract org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter createJpaVendorAdapter()
getVendorProperties
protected abstract Map<String,Object> getVendorProperties()
customizeVendorProperties
protected void customizeVendorProperties(Map<String,Object> vendorProperties)
Customize vendor properties before they are used. Allows for post processing (for example to configure JTA specific settings).- Parameters:
vendorProperties
- the vendor properties to customize
getPackagesToScan
protected String[] getPackagesToScan()
getJtaTransactionManager
protected org.springframework.transaction.jta.JtaTransactionManager getJtaTransactionManager()
Return the JTA transaction manager.- Returns:
- the transaction manager or
null
isJta
protected final boolean isJta()
Returns if a JTAPlatformTransactionManager
is being used.- Returns:
- if a JTA transaction manager is being used
getProperties
protected final JpaProperties getProperties()
Return theJpaProperties
.- Returns:
- the properties
getDataSource
protected final DataSource getDataSource()
Return theDataSource
.- Returns:
- the data source
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
- Specified by:
setBeanFactory
in interfaceorg.springframework.beans.factory.BeanFactoryAware
- Throws:
org.springframework.beans.BeansException