31 lines
1.2 KiB
Groovy
31 lines
1.2 KiB
Groovy
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')
|
|
}
|
|
} |