|
@@ -109,34 +109,9 @@ public class DataSourceUtils {
|
|
|
while (!StringUtils.isEmpty(line = bufferedReader.readLine())) {
|
|
while (!StringUtils.isEmpty(line = bufferedReader.readLine())) {
|
|
|
stringBuilder.append(line);
|
|
stringBuilder.append(line);
|
|
|
}
|
|
}
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(stringBuilder.toString());
|
|
|
|
|
- DruidDataSource dataSource = new DruidDataSource();
|
|
|
|
|
- dataSource.setDriverClassName(jsonObject.getString("driverClassName"));
|
|
|
|
|
- dataSource.setUrl(jsonObject.getString("url"));
|
|
|
|
|
- dataSource.setUsername(jsonObject.getString("username"));
|
|
|
|
|
- dataSource.setPassword(jsonObject.getString("password"));
|
|
|
|
|
- dataSource.setInitialSize(jsonObject.getIntValue("initialSize"));
|
|
|
|
|
- dataSource.setMinIdle(jsonObject.getIntValue("minIdle"));
|
|
|
|
|
- dataSource.setMaxActive(jsonObject.getIntValue("maxActive"));
|
|
|
|
|
- dataSource.setMaxWait(jsonObject.getLongValue("maxWait"));
|
|
|
|
|
- dataSource.setTimeBetweenEvictionRunsMillis(jsonObject.getLongValue("timeBetweenEvictionRunsMillis"));
|
|
|
|
|
- dataSource.setMinEvictableIdleTimeMillis(jsonObject.getLongValue("minEvictableIdleTimeMillis"));
|
|
|
|
|
- dataSource.setValidationQuery(jsonObject.getString("validationQuery"));
|
|
|
|
|
- dataSource.setTestWhileIdle(jsonObject.getBooleanValue("testWhileIdle"));
|
|
|
|
|
- dataSource.setTestOnBorrow(jsonObject.getBooleanValue("testOnBorrow"));
|
|
|
|
|
- dataSource.setTestOnReturn(jsonObject.getBooleanValue("testOnReturn"));
|
|
|
|
|
- dataSource.setRemoveAbandoned(jsonObject.getBooleanValue("removeAbandoned"));
|
|
|
|
|
- dataSource.setRemoveAbandoned(jsonObject.getBooleanValue("removeAbandonedTimeout"));
|
|
|
|
|
- dataSource.setLogAbandoned(jsonObject.getBooleanValue("logAbandoned"));
|
|
|
|
|
- dataSource.setPoolPreparedStatements(jsonObject.getBooleanValue("poolPreparedStatements"));
|
|
|
|
|
- dataSource.setMaxPoolPreparedStatementPerConnectionSize(
|
|
|
|
|
- jsonObject.getIntValue("maxPoolPreparedStatementPerConnectionSize"));
|
|
|
|
|
- dataSource.setFilters(jsonObject.getString("filters"));
|
|
|
|
|
- return dataSource;
|
|
|
|
|
|
|
+ return JSONObject.parseObject(stringBuilder.toString(), DruidDataSource.class);
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
- } catch (SQLException e) {
|
|
|
|
|
- logger.error("druid configuration initialization filter");
|
|
|
|
|
} finally {
|
|
} finally {
|
|
|
if (bufferedReader != null) {
|
|
if (bufferedReader != null) {
|
|
|
try {
|
|
try {
|