mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
Polish alibaba/spring-cloud-alibaba#1363 : Sync spring-cloud-alibaba-sentinel-datasource module
This commit is contained in:
parent
1d9c1975b2
commit
d11f2a0608
@ -17,6 +17,7 @@
|
|||||||
package com.alibaba.cloud.sentinel.datasource.config;
|
package com.alibaba.cloud.sentinel.datasource.config;
|
||||||
|
|
||||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ConsulDataSourceFactoryBean;
|
import com.alibaba.cloud.sentinel.datasource.factorybean.ConsulDataSourceFactoryBean;
|
||||||
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,8 +55,7 @@ public class ConsulDataSourceProperties extends AbstractDataSourceProperties {
|
|||||||
@Override
|
@Override
|
||||||
public void preCheck(String dataSourceName) {
|
public void preCheck(String dataSourceName) {
|
||||||
if (StringUtils.isEmpty(host)) {
|
if (StringUtils.isEmpty(host)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException("ConsulDataSource server-host is empty");
|
||||||
"ConsulDataSource server-host is empty");
|
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(ruleKey)) {
|
if (StringUtils.isEmpty(ruleKey)) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
@ -18,6 +18,7 @@ package com.alibaba.cloud.sentinel.datasource.factorybean;
|
|||||||
|
|
||||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||||
import com.alibaba.csp.sentinel.datasource.consul.ConsulDataSource;
|
import com.alibaba.csp.sentinel.datasource.consul.ConsulDataSource;
|
||||||
|
|
||||||
import org.springframework.beans.factory.FactoryBean;
|
import org.springframework.beans.factory.FactoryBean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,12 +41,7 @@ public class ConsulDataSourceFactoryBean implements FactoryBean<ConsulDataSource
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConsulDataSource getObject() throws Exception {
|
public ConsulDataSource getObject() throws Exception {
|
||||||
return new ConsulDataSource(
|
return new ConsulDataSource(host, port, ruleKey, waitTimeoutInSecond, converter);
|
||||||
host,
|
|
||||||
port,
|
|
||||||
ruleKey,
|
|
||||||
waitTimeoutInSecond,
|
|
||||||
converter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user