Archived
0

переход на groovy конфигурацию

This commit is contained in:
2019-02-17 23:26:03 +03:00
parent f08190fba7
commit 72c24b2adf
17 changed files with 198 additions and 211 deletions

View File

@@ -0,0 +1,31 @@
def hibernateProps = new Properties()
hibernateProps.put('hibernate.dialect', 'org.hibernate.dialect.H2Dialect')
hibernateProps.put('hibernate.show_sql', false)
hibernateProps.put('hibernate.hbm2ddl.auto', 'update')
beans {
xmlns([context: 'http://www.springframework.org/schema/context'])
context.'annotation-config'()
context.'component-scan'('base-package': 'mc.core.h2db')
xmlns([jpa: 'http://www.springframework.org/schema/data/jpa'])
jpa.'repositories'('base-package': 'mc.core.h2db.repository')
dataSource(org.springframework.jdbc.datasource.DriverManagerDataSource) {
driverClassName = 'org.h2.Driver'
url = 'jdbc:h2:mem:test;DB_CLOSE_DELAY=-1'
username = 'sa'
password = 's3cReT'
}
entityManagerFactory(org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean) {
dataSource = ref('dataSource')
persistenceProviderClass = 'org.hibernate.jpa.HibernatePersistenceProvider'
packagesToScan = 'mc.core.h2db.entity'
jpaProperties = hibernateProps
}
transactionManager(org.springframework.orm.jpa.JpaTransactionManager) {
entityManagerFactory = ref('entityManagerFactory')
}
}