mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Polish alibaba/spring-cloud-alibaba#1739 : Sync the Sentinel DataSource from master
This commit is contained in:
parent
bae6878c0d
commit
4003d3e15b
@ -47,9 +47,23 @@ public class DataSourcePropertiesConfiguration {
|
||||
|
||||
private RedisDataSourceProperties redis;
|
||||
|
||||
private ConsulDataSourceProperties consul;
|
||||
|
||||
public DataSourcePropertiesConfiguration() {
|
||||
}
|
||||
|
||||
public DataSourcePropertiesConfiguration(ConsulDataSourceProperties consul) {
|
||||
this.consul = consul;
|
||||
}
|
||||
|
||||
public ConsulDataSourceProperties getConsul() {
|
||||
return consul;
|
||||
}
|
||||
|
||||
public void setConsul(ConsulDataSourceProperties consul) {
|
||||
this.consul = consul;
|
||||
}
|
||||
|
||||
public DataSourcePropertiesConfiguration(FileDataSourceProperties file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
@ -32,6 +32,10 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
|
||||
|
||||
private String serverAddr;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
@NotEmpty
|
||||
private String groupId = "DEFAULT_GROUP";
|
||||
|
||||
@ -67,6 +71,22 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
|
||||
this.serverAddr = serverAddr;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import com.alibaba.cloud.sentinel.datasource.factorybean.RedisDataSourceFactoryB
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Zookeeper Properties class Using by {@link DataSourcePropertiesConfiguration} and
|
||||
* Redis Properties class Using by {@link DataSourcePropertiesConfiguration} and
|
||||
* {@link RedisDataSourceFactoryBean}.
|
||||
*
|
||||
* @author <a href="mailto:wangiegie@gmail.com">lengleng</a>
|
||||
@ -93,7 +93,7 @@ public class RedisDataSourceProperties extends AbstractDataSourceProperties {
|
||||
"RedisDataSource channel can not be empty");
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(masterId) && StringUtils.isEmpty(masterId)) {
|
||||
if (StringUtils.isEmpty(masterId)) {
|
||||
throw new IllegalArgumentException(
|
||||
"RedisDataSource sentinel model,masterId can not be empty");
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ public class NacosDataSourceFactoryBean implements FactoryBean<NacosDataSource>
|
||||
|
||||
private String serverAddr;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String dataId;
|
||||
@ -63,6 +67,12 @@ public class NacosDataSourceFactoryBean implements FactoryBean<NacosDataSource>
|
||||
if (!StringUtils.isEmpty(this.namespace)) {
|
||||
properties.setProperty(PropertyKeyConst.NAMESPACE, this.namespace);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -79,6 +89,21 @@ public class NacosDataSourceFactoryBean implements FactoryBean<NacosDataSource>
|
||||
this.serverAddr = serverAddr;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user