1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

sentinel NacosDataSourceFactoryBean enhance

This commit is contained in:
yuhuangbin 2020-09-14 08:57:08 +08:00
parent df156d4fa2
commit 5b0d53388b

View File

@ -67,8 +67,12 @@ public class NacosDataSourceFactoryBean implements FactoryBean<NacosDataSource>
if (!StringUtils.isEmpty(this.namespace)) {
properties.setProperty(PropertyKeyConst.NAMESPACE, this.namespace);
}
properties.setProperty(PropertyKeyConst.USERNAME, this.username);
properties.setProperty(PropertyKeyConst.PASSWORD, this.password);
if (!StringUtils.isEmpty(this.username)) {
properties.setProperty(PropertyKeyConst.USERNAME, this.username);
}
if (!StringUtils.isEmpty(this.password)) {
properties.setProperty(PropertyKeyConst.PASSWORD, this.password);
}
return new NacosDataSource(properties, groupId, dataId, converter);
}