Skip to content

Commit 8c444e7

Browse files
committed
默认不启用字段插件,优化数据库连接池
1 parent bfd832d commit 8c444e7

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/boot/DemoApplication.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static void main(String[] args) throws Exception {
8686
AbstractParser.IS_PRINT_BIG_LOG = true; // 是否打印大日志
8787
APIJSONVerifier.ENABLE_APIJSON_ROUTER = true; // apijson-framework 已集成字段插件 apijson-router,是否开启 接口路由 模式,支持简单接口转为 APIJSON JSON
8888
//APIJSONParser.IS_START_FROM_1 = true; // 分页页码是否从 1 开始,true - 从 1 开始;false - 从 0 开始
89-
APIJSONSQLConfig.ENABLE_COLUMN_CONFIG = true; // apijson-framework 已集成字段插件 apijson-column,支持 !key 反选字段 和 字段名映射
89+
APIJSONSQLConfig.ENABLE_COLUMN_CONFIG = false; // apijson-framework 已集成字段插件 apijson-column,支持 !key 反选字段 和 字段名映射
9090
APIJSONApplication.init();
9191
System.out.println("\n\n<<<<<<<<< 本 Demo 在 resources/static 内置了 APIAuto,Chrome/Firefox 打开 http://localhost:8080 即可调试(端口号根据项目配置而定) ^_^ >>>>>>>>>\n");
9292
}

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/boot/DemoController.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -704,10 +704,8 @@ public JSONObject headVerify(int type, String phone, String code) {
704704
return newErrorResult(new TimeoutException("验证码已过期!"));
705705
}
706706

707-
return new JSONResponse(
708-
new DemoParser(HEADS, false).parseResponse(
709-
newVerifyRequest(type, phone, code)
710-
)
707+
return new DemoParser(HEADS, false).parseResponse(
708+
newVerifyRequest(type, phone, code)
711709
);
712710
}
713711

@@ -961,8 +959,6 @@ public JSONObject register(@RequestBody String request) {
961959
return extendErrorResult(response, new ConditionErrorException("手机号或验证码错误!"));
962960
}
963961

964-
965-
966962
//生成User和Privacy
967963
if (StringUtil.isEmpty(requestObject.getString(JSONRequest.KEY_TAG), true)) {
968964
requestObject.put(JSONRequest.KEY_TAG, REGISTER);

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/java/apijson/demo/DemoSQLExecutor.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public Connection getConnection(SQLConfig<Long, JSONObject, JSONArray> config) t
131131
Log.d(TAG, "getConnection config.getDatasource() = " + datasource);
132132

133133
String key = datasource + "-" + config.getDatabase();
134-
Connection c = connectionMap.get(key);
134+
Connection c = getConnection(key);
135135
if (datasource != null && (c == null || c.isClosed())) {
136136
try {
137137
DataSource ds;
@@ -160,7 +160,7 @@ public Connection getConnection(SQLConfig<Long, JSONObject, JSONArray> config) t
160160
break;
161161
}
162162

163-
connectionMap.put(key, ds == null ? null : ds.getConnection());
163+
putConnection(key, ds == null ? null : ds.getConnection());
164164
} catch (Exception e) {
165165
Log.e(TAG, "getConnection try { "
166166
+ "DataSource ds = DemoApplication.getApplicationContext().getBean(DataSource.class); .."

0 commit comments

Comments
 (0)