sunyj 9 лет назад
Родитель
Сommit
aeed244e69
1 измененных файлов с 1 добавлено и 26 удалено
  1. 1 26
      src/main/java/com/uas/report/util/DataSourceUtils.java

+ 1 - 26
src/main/java/com/uas/report/util/DataSourceUtils.java

@@ -109,34 +109,9 @@ public class DataSourceUtils {
 				while (!StringUtils.isEmpty(line = bufferedReader.readLine())) {
 					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) {
 				e.printStackTrace();
-			} catch (SQLException e) {
-				logger.error("druid configuration initialization filter");
 			} finally {
 				if (bufferedReader != null) {
 					try {