DataSourceProperties.java 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. package com.sqx.datasource.properties;
  2. /**
  3. * 多数据源属性
  4. *
  5. */
  6. public class DataSourceProperties {
  7. private String driverClassName;
  8. private String url;
  9. private String username;
  10. private String password;
  11. /**
  12. * Druid默认参数
  13. */
  14. private int initialSize = 2;
  15. private int maxActive = 10;
  16. private int minIdle = -1;
  17. private long maxWait = 60 * 1000L;
  18. private long timeBetweenEvictionRunsMillis = 60 * 1000L;
  19. private long minEvictableIdleTimeMillis = 1000L * 60L * 30L;
  20. private long maxEvictableIdleTimeMillis = 1000L * 60L * 60L * 7;
  21. private String validationQuery = "select 1";
  22. private int validationQueryTimeout = -1;
  23. private boolean testOnBorrow = false;
  24. private boolean testOnReturn = false;
  25. private boolean testWhileIdle = true;
  26. private boolean poolPreparedStatements = false;
  27. private int maxOpenPreparedStatements = -1;
  28. private boolean sharePreparedStatements = false;
  29. private String filters = "stat,wall";
  30. public String getDriverClassName() {
  31. return driverClassName;
  32. }
  33. public void setDriverClassName(String driverClassName) {
  34. this.driverClassName = driverClassName;
  35. }
  36. public String getUrl() {
  37. return url;
  38. }
  39. public void setUrl(String url) {
  40. this.url = url;
  41. }
  42. public String getUsername() {
  43. return username;
  44. }
  45. public void setUsername(String username) {
  46. this.username = username;
  47. }
  48. public String getPassword() {
  49. return password;
  50. }
  51. public void setPassword(String password) {
  52. this.password = password;
  53. }
  54. public int getInitialSize() {
  55. return initialSize;
  56. }
  57. public void setInitialSize(int initialSize) {
  58. this.initialSize = initialSize;
  59. }
  60. public int getMaxActive() {
  61. return maxActive;
  62. }
  63. public void setMaxActive(int maxActive) {
  64. this.maxActive = maxActive;
  65. }
  66. public int getMinIdle() {
  67. return minIdle;
  68. }
  69. public void setMinIdle(int minIdle) {
  70. this.minIdle = minIdle;
  71. }
  72. public long getMaxWait() {
  73. return maxWait;
  74. }
  75. public void setMaxWait(long maxWait) {
  76. this.maxWait = maxWait;
  77. }
  78. public long getTimeBetweenEvictionRunsMillis() {
  79. return timeBetweenEvictionRunsMillis;
  80. }
  81. public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
  82. this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
  83. }
  84. public long getMinEvictableIdleTimeMillis() {
  85. return minEvictableIdleTimeMillis;
  86. }
  87. public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
  88. this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
  89. }
  90. public long getMaxEvictableIdleTimeMillis() {
  91. return maxEvictableIdleTimeMillis;
  92. }
  93. public void setMaxEvictableIdleTimeMillis(long maxEvictableIdleTimeMillis) {
  94. this.maxEvictableIdleTimeMillis = maxEvictableIdleTimeMillis;
  95. }
  96. public String getValidationQuery() {
  97. return validationQuery;
  98. }
  99. public void setValidationQuery(String validationQuery) {
  100. this.validationQuery = validationQuery;
  101. }
  102. public int getValidationQueryTimeout() {
  103. return validationQueryTimeout;
  104. }
  105. public void setValidationQueryTimeout(int validationQueryTimeout) {
  106. this.validationQueryTimeout = validationQueryTimeout;
  107. }
  108. public boolean isTestOnBorrow() {
  109. return testOnBorrow;
  110. }
  111. public void setTestOnBorrow(boolean testOnBorrow) {
  112. this.testOnBorrow = testOnBorrow;
  113. }
  114. public boolean isTestOnReturn() {
  115. return testOnReturn;
  116. }
  117. public void setTestOnReturn(boolean testOnReturn) {
  118. this.testOnReturn = testOnReturn;
  119. }
  120. public boolean isTestWhileIdle() {
  121. return testWhileIdle;
  122. }
  123. public void setTestWhileIdle(boolean testWhileIdle) {
  124. this.testWhileIdle = testWhileIdle;
  125. }
  126. public boolean isPoolPreparedStatements() {
  127. return poolPreparedStatements;
  128. }
  129. public void setPoolPreparedStatements(boolean poolPreparedStatements) {
  130. this.poolPreparedStatements = poolPreparedStatements;
  131. }
  132. public int getMaxOpenPreparedStatements() {
  133. return maxOpenPreparedStatements;
  134. }
  135. public void setMaxOpenPreparedStatements(int maxOpenPreparedStatements) {
  136. this.maxOpenPreparedStatements = maxOpenPreparedStatements;
  137. }
  138. public boolean isSharePreparedStatements() {
  139. return sharePreparedStatements;
  140. }
  141. public void setSharePreparedStatements(boolean sharePreparedStatements) {
  142. this.sharePreparedStatements = sharePreparedStatements;
  143. }
  144. public String getFilters() {
  145. return filters;
  146. }
  147. public void setFilters(String filters) {
  148. this.filters = filters;
  149. }
  150. }