提交 6bf64f55 编写于 作者: sq3536's avatar sq3536

model

上级 065bc20e
......@@ -7,11 +7,11 @@ spring:
cloud:
nacos:
discovery:
server-addr: 192.168.3.23:8848
server-addr: 172.16.100.77:8848
datasource:
username: root
password: root
defaultSchema: a_A_5d9d78509
url: jdbc:mysql://192.168.3.23:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true
url: jdbc:mysql://172.16.100.77:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true
redis:
host: 192.168.3.23
\ No newline at end of file
host: 172.16.100.77
\ No newline at end of file
......@@ -48,6 +48,8 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
{
synchronized (lock)
{
if (check.containsKey(dstDataSource.getDsName()))
return super.buildDS(dstDataSource);
DataSourceProperty dataSourceProperty = new DataSourceProperty();
DynamicRoutingDataSource ds = dataSource;
List<Setting> settings = JSONArray.parseArray(dstDataSource.getDsCfg(), Setting.class);
......@@ -64,7 +66,9 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
else if (setting.getProperty().equalsIgnoreCase("defaultSchema"))
dataSourceProperty.setSchema(setting.getValue());
}
DataSource dataSource = BasicDataSourceCreator.getInstance().createDataSource(dataSourceProperty);
dataSourceProperty.getDruid().setFilters("stat,log4j2");
DataSource dataSource = druidDataSourceCreator.createDataSource(dataSourceProperty);
ds.addDataSource(dstDataSource.getDsName(), dataSource);
check.put(dstDataSource.getDsName(), 1);
......@@ -80,7 +84,7 @@ public class DstDataSourceExService extends DstDataSourceServiceImpl {
@Autowired
@Lazy
private DruidDataSourceCreator druidDataSourceCreator;
private DataSourceCreator druidDataSourceCreator;
private HashMap<String,Integer> check=new HashMap<>();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册