Advertisement
Guest User

Untitled

a guest
Jan 13th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. import org.springframework.cloud.CloudFactory
  2. import org.springframework.cloud.CloudException
  3.  
  4. dataSource {
  5. pooled = true
  6. driverClassName = "oracle.jdbc.driver.OracleDriver"
  7. dialect='org.hibernate.dialect.Oracle10gDialect'
  8. }
  9.  
  10. hibernate {
  11. cache.use_second_level_cache=true
  12. cache.use_query_cache=true
  13. cache.provider_class='org.hibernate.cache.EhCacheProvider'
  14. show_sql=true
  15. }
  16.  
  17. def cloud = null
  18. try {
  19. cloud = new CloudFactory().cloud
  20. } catch (CloudException) {}
  21.  
  22. def dbInfo = cloud?.getServiceInfo('foo')
  23. url = dbInfo?.url
  24. username = dbInfo?.username
  25. password = dbInfo?.password
  26.  
  27. // environment specific settings
  28. environments {
  29. development {
  30. dataSource {
  31. url = dbInfo?.url
  32. username = dbInfo?.username
  33. password = dbInfo?.password
  34. }
  35. }
  36. test {
  37. dataSource {
  38. url = dbInfo?.url
  39. username = dbInfo?.username
  40. password = dbInfo?.password
  41. }
  42. }
  43. production {
  44. dataSource {
  45. url = ""
  46. username=""
  47. password= ""
  48. }
  49. }
  50. }
  51.  
  52. import org.springframework.cloud.CloudFactory
  53. import org.springframework.cloud.CloudException
  54.  
  55. beans = {
  56.  
  57. cloudFactory(org.springframework.cloud.CloudFactory)
  58. def cloud = null
  59. try {
  60. cloud = new CloudFactory().cloud
  61. } catch (CloudException) {}
  62.  
  63. def dbLegacyInfo = cloud?.getServiceInfo('bar')
  64. def dbU2Info = cloud?.getServiceInfo('faa')
  65.  
  66. ibatisTemplate(org.springframework.orm.ibatis.SqlMapClientTemplate) {
  67. sqlMapClient = ref("sqlMapClient")
  68. }
  69. sqlMapClient(org.springframework.orm.ibatis.SqlMapClientFactoryBean) {
  70. configLocation = "classpath:ibatis/sqlmap-config.xml"
  71. dataSource = ref("dataSource")
  72. }
  73.  
  74. ibatisTemplateU2(org.springframework.orm.ibatis.SqlMapClientTemplate) {
  75. sqlMapClient = ref("sqlMapClientU2")
  76. }
  77.  
  78. sqlMapClientU2(org.springframework.orm.ibatis.SqlMapClientFactoryBean) {
  79. configLocation = "classpath:ibatis/sqlmap-config-ef.xml"
  80. dataSource = ref("dataSourceU2")
  81. }
  82.  
  83. dataSourceU2(org.apache.commons.dbcp.BasicDataSource) {
  84. driverClassName = "oracle.jdbc.driver.OracleDriver"
  85. url = dbU2Info?.jdbcUrl
  86. username = dbU2Info?.userName
  87. password = dbU2Info?.password
  88. }
  89.  
  90. ibatisTemplateLegacy(org.springframework.orm.ibatis.SqlMapClientTemplate) {
  91. sqlMapClient = ref("sqlMapClientLegacy")
  92. }
  93.  
  94. sqlMapClientLegacy(org.springframework.orm.ibatis.SqlMapClientFactoryBean) {
  95. configLocation = "classpath:ibatis/sqlmap-config-ef.xml"
  96. dataSource = ref("dataSourceLegacy")
  97. }
  98.  
  99. dataSourceLegacy(org.apache.commons.dbcp.BasicDataSource) {
  100. driverClassName = "oracle.jdbc.driver.OracleDriver"
  101. url = dbLegacyInfo?.jdbcUrl
  102. username = dbLegacyInfo?.userName
  103. password = dbLegacyInfo?.password
  104. }
  105.  
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement