|
@@ -60,14 +60,15 @@ public class DynamicDataSourceHandler extends HandlerInterceptorAdapter {
|
|
|
}
|
|
|
// 默认为应用名
|
|
|
String dbNameDefault = SpringHelper.getString("spring.application.name");
|
|
|
- String newDsName = dbNameDefault;
|
|
|
+ // 将应用名中的中划线替换为下划线,按照公司要求应用名统一用中划线,数据库名统一用下划线
|
|
|
+ String newDsName = dbNameDefault.replace("-", "_");
|
|
|
if (StringUtils.isNotBlank(PoemsContext.getContext().getGroupCode())) {
|
|
|
// 创建的数据源名称: 集团编码_应用名
|
|
|
newDsName = PoemsContext.getContext().getGroupCode() + "_" + dbNameDefault;
|
|
|
}
|
|
|
|
|
|
// 数据源中是否已存在
|
|
|
- if(!dataSource.getCurrentDataSources().keySet().contains(newDsName)) {
|
|
|
+ if(!dataSource.getCurrentDataSources().containsKey(newDsName)) {
|
|
|
// 设置新数据源
|
|
|
DataSourceProperty property = copyProperty(dbNameDefault, newDsName);
|
|
|
// 创建数据库实例
|