Skip to content

Commit 842a5cd

Browse files
committed
Java:MultiDataSource 继承 apijson-framework 的数据库默认配置,新增支持 Doris-高性能实时湖仓一体数据库的默认配置
1 parent d31172a commit 842a5cd

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

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

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

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,11 @@ public String gainDBUri() {
279279
//if (isOpenGauss()) {
280280
// return "jdbc:opengauss://127.0.0.1:5432/postgres?currentSchema=" + DEFAULT_SCHEMA; //TODO 改成你自己的
281281
//}
282+
//if (isDoris()) {
283+
// return "jdbc:mysql://localhost:9030"; //TODO 改成你自己的,TiDB 可以当成 MySQL 使用,默认端口为 4000
284+
//}
282285

283-
return null;
286+
return super.gainDBUri();
284287
}
285288

286289
private String dbAccount;
@@ -356,8 +359,11 @@ public String gainDBAccount() {
356359
// return "postgres"; //TODO 改成你自己的
357360
// // 不允许用初始账号,需要 CREATE USER 创建新账号并 GRANT 授权 return "opengauss"; //TODO 改成你自己的
358361
//}
362+
//if (isDoris()) {
363+
// return "root";
364+
//}
359365

360-
return null;
366+
return super.gainDBAccount();
361367
}
362368

363369
private String dbPassword;
@@ -432,8 +438,11 @@ public String gainDBPassword() {
432438
//if (isOpenGauss()) {
433439
// return "openGauss@123"; //TODO 改成你自己的
434440
//}
441+
//if (isDoris()) {
442+
// return "apijson";
443+
//}
435444

436-
return null;
445+
return super.gainDBPassword();
437446
}
438447

439448
private String sql;

0 commit comments

Comments
 (0)