fix: 优化了动态数据源识别不到oracle问题
This commit is contained in:
parent
a472ab2ec7
commit
2598c10cbb
@ -7,7 +7,12 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.StatementCallback;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
||||
@ -55,25 +55,6 @@ public class DynamicDataSourceRegistry {
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
try {
|
||||
List<GenDatasourceConf> configs = loadConfigs();
|
||||
if (configs.isEmpty()) {
|
||||
log.info("GEN_DATASOURCE_CONF 表中无已启用的动态数据源配置,跳过注册");
|
||||
return;
|
||||
}
|
||||
int success = 0;
|
||||
int fail = 0;
|
||||
for (GenDatasourceConf conf : configs) {
|
||||
if (tryRegister(conf)) {
|
||||
success++;
|
||||
} else {
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
log.info("动态数据源初始化完成: 成功={}, 失败={}", success, fail);
|
||||
} catch (Exception e) {
|
||||
log.error("动态数据源初始化失败(业务主库未就绪,稍后手动刷新即可): {}", e.getMessage());
|
||||
}
|
||||
REGISTRY_EXECUTOR.submit(() -> {
|
||||
try {
|
||||
log.info("动态数据源后台初始化开始...");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user