|
|
@@ -2,6 +2,7 @@ package com.usoftchina.bi.server.service.dataSource;
|
|
|
|
|
|
import com.usoftchina.bi.core.exception.MyException;
|
|
|
import com.usoftchina.bi.core.utils.ContextUtil;
|
|
|
+import com.usoftchina.bi.core.utils.JsonUtils;
|
|
|
import com.usoftchina.bi.server.dao.dataSource.DataConnectorMapper;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.type.CollectionType;
|
|
|
@@ -205,13 +206,17 @@ public class DataBasesService {
|
|
|
if (target.size() == 0) {
|
|
|
target.putAll(dataSourceRegister.getSlaveDataSources());
|
|
|
}
|
|
|
- if (!target.containsKey(databasesInfo.getId())) {
|
|
|
+ LOGGER.info("target={}, containsKey({}) is {}", target, databasesInfo.getId(), target.containsKey(String.valueOf(databasesInfo.getId())));
|
|
|
+ if (!target.containsKey(String.valueOf(databasesInfo.getId()))) {
|
|
|
LOGGER.info("创建数据源");
|
|
|
target.put(databasesInfo.getId(), dataSourceRegister.buildDataSource(dsMap));
|
|
|
LOGGER.info("创建数据源结束");
|
|
|
DynamicDataSource datasource = (DynamicDataSource) ContextUtil.getBean("dataSource");
|
|
|
+ LOGGER.info("datasource={}", JsonUtils.toJsonString(datasource));
|
|
|
datasource.setTargetDataSources(target);
|
|
|
+ LOGGER.info("setTargetDataSources...ok");
|
|
|
datasource.afterPropertiesSet();
|
|
|
+ LOGGER.info("afterPropertiesSet...ok");
|
|
|
|
|
|
DynamicDataSourceContextHolder.dataSourceIds.add(String.valueOf(databasesInfo.getId()));
|
|
|
LOGGER.info("注册数据源完成,id={}", databasesInfo.getId());
|