Skip to content

Commit c00bc99

Browse files
author
litongjava
committed
update TableToJsonConfig for postgresql
1 parent a01026b commit c00bc99

File tree

1 file changed

+3
-5
lines changed
  • docs/zh/15_table-to-json

1 file changed

+3
-5
lines changed

docs/zh/15_table-to-json/03.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ public class TableToJsonConfig {
146146
**配置方式 2:不添加类到 AOP 容器**
147147

148148
```
149-
package com.litongjava.apps.asrgpt.config;
150-
151149
import javax.sql.DataSource;
152150
153151
import com.jfinal.template.Engine;
@@ -166,8 +164,7 @@ import com.zaxxer.hikari.HikariDataSource;
166164
@AConfiguration
167165
public class TableToJsonConfig {
168166
169-
@AInitialization
170-
public void dataSource() {
167+
public DataSource dataSource() {
171168
String jdbcUrl = EnvironmentUtils.get("jdbc.url");
172169
String jdbcUser = EnvironmentUtils.get("jdbc.user");
173170
@@ -187,6 +184,7 @@ public class TableToJsonConfig {
187184
DsContainer.setDataSource(hikariDataSource);
188185
// add destroy
189186
TioBootServer.me().addDestroyMethod(hikariDataSource::close);
187+
return hikariDataSource;
190188
191189
}
192190
@@ -198,7 +196,7 @@ public class TableToJsonConfig {
198196
@AInitialization
199197
public void activeRecordPlugin() throws Exception {
200198
// get dataSource
201-
DataSource dataSource = DsContainer.ds;
199+
DataSource dataSource = dataSource();
202200
// get env key
203201
String property = EnvironmentUtils.get(ConfigKeys.APP_ENV);
204202

0 commit comments

Comments
 (0)