Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.zaxxer.hikari.HikariConfig
- import com.zaxxer.hikari.HikariDataSource
- // Place your Spring DSL code here
- beans = {
- def config = application.config
- println config
- def dataSources = config.findAll {
- pritnln it.key.toString()
- it.key.toString().contains("dataSource")
- }
- dataSources.each { key, value ->
- println key + value
- def ds = value
- "${key}"(HikariDataSource, { bean ->
- def hp = new Properties()
- hp.username = ds.username
- hp.password = ds.password
- hp.connectionTimeout = 6000
- hp.maximumPoolSize = 60
- hp.jdbcUrl = ds.url
- hp.driverClassName = ds.driverClassName
- HikariConfig hc = new HikariConfig(hp)
- bean.constructorArgs = [hc]
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement