Commit c00bc99 litongjava
committed
1 parent a01026b commit c00bc99 Copy full SHA for c00bc99
File tree 1 file changed +3
-5
lines changed
1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -146,8 +146,6 @@ public class TableToJsonConfig {
146
146
** 配置方式 2:不添加类到 AOP 容器**
147
147
148
148
```
149
- package com.litongjava.apps.asrgpt.config;
150
-
151
149
import javax.sql.DataSource;
152
150
153
151
import com.jfinal.template.Engine;
@@ -166,8 +164,7 @@ import com.zaxxer.hikari.HikariDataSource;
166
164
@AConfiguration
167
165
public class TableToJsonConfig {
168
166
169
- @AInitialization
170
- public void dataSource() {
167
+ public DataSource dataSource() {
171
168
String jdbcUrl = EnvironmentUtils.get("jdbc.url");
172
169
String jdbcUser = EnvironmentUtils.get("jdbc.user");
173
170
@@ -187,6 +184,7 @@ public class TableToJsonConfig {
187
184
DsContainer.setDataSource(hikariDataSource);
188
185
// add destroy
189
186
TioBootServer.me().addDestroyMethod(hikariDataSource::close);
187
+ return hikariDataSource;
190
188
191
189
}
192
190
@@ -198,7 +196,7 @@ public class TableToJsonConfig {
198
196
@AInitialization
199
197
public void activeRecordPlugin() throws Exception {
200
198
// get dataSource
201
- DataSource dataSource = DsContainer.ds ;
199
+ DataSource dataSource = dataSource() ;
202
200
// get env key
203
201
String property = EnvironmentUtils.get(ConfigKeys.APP_ENV);
204
202
You can’t perform that action at this time.
0 commit comments