Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import com.zaxxer.hikari.HikariConfig
  2. import com.zaxxer.hikari.HikariDataSource
  3. // Place your Spring DSL code here
  4. beans = {
  5.  
  6. def config = application.config
  7. println config
  8. def dataSources = config.findAll {
  9. pritnln it.key.toString()
  10. it.key.toString().contains("dataSource")
  11. }
  12.  
  13. dataSources.each { key, value ->
  14. println key + value
  15. def ds = value
  16. "${key}"(HikariDataSource, { bean ->
  17.  
  18. def hp = new Properties()
  19. hp.username = ds.username
  20. hp.password = ds.password
  21. hp.connectionTimeout = 6000
  22. hp.maximumPoolSize = 60
  23. hp.jdbcUrl = ds.url
  24. hp.driverClassName = ds.driverClassName
  25.  
  26. HikariConfig hc = new HikariConfig(hp)
  27. bean.constructorArgs = [hc]
  28. })
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement