mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sentinel 1.x add jsr and update version of validation-api
This commit is contained in:
parent
f339f30b7b
commit
eeedf90d86
@ -86,7 +86,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
<version>2.0.1.Final</version>
|
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.cloud.alibaba.sentinel.datasource.RuleType;
|
import org.springframework.cloud.alibaba.sentinel.datasource.RuleType;
|
||||||
@ -37,7 +36,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
*/
|
*/
|
||||||
public class AbstractDataSourceProperties {
|
public class AbstractDataSourceProperties {
|
||||||
|
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String dataType = "json";
|
private String dataType = "json";
|
||||||
@NotNull
|
@NotNull
|
||||||
private RuleType ruleType;
|
private RuleType ruleType;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ApolloDataSourceFactoryBean;
|
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ApolloDataSourceFactoryBean;
|
||||||
|
|
||||||
@ -28,9 +28,9 @@ import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ApolloD
|
|||||||
*/
|
*/
|
||||||
public class ApolloDataSourceProperties extends AbstractDataSourceProperties {
|
public class ApolloDataSourceProperties extends AbstractDataSourceProperties {
|
||||||
|
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String namespaceName;
|
private String namespaceName;
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String flowRulesKey;
|
private String flowRulesKey;
|
||||||
private String defaultFlowRuleValue;
|
private String defaultFlowRuleValue;
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
@ -19,12 +21,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
*/
|
*/
|
||||||
public class DataSourcePropertiesConfiguration {
|
public class DataSourcePropertiesConfiguration {
|
||||||
|
|
||||||
|
@Valid
|
||||||
private FileDataSourceProperties file;
|
private FileDataSourceProperties file;
|
||||||
|
|
||||||
|
@Valid
|
||||||
private NacosDataSourceProperties nacos;
|
private NacosDataSourceProperties nacos;
|
||||||
|
|
||||||
|
@Valid
|
||||||
private ZookeeperDataSourceProperties zk;
|
private ZookeeperDataSourceProperties zk;
|
||||||
|
|
||||||
|
@Valid
|
||||||
private ApolloDataSourceProperties apollo;
|
private ApolloDataSourceProperties apollo;
|
||||||
|
|
||||||
public DataSourcePropertiesConfiguration() {
|
public DataSourcePropertiesConfiguration() {
|
||||||
|
@ -18,7 +18,7 @@ package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.FileRefreshableDataSourceFactoryBean;
|
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.FileRefreshableDataSourceFactoryBean;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
@ -32,7 +32,7 @@ import org.springframework.util.StringUtils;
|
|||||||
*/
|
*/
|
||||||
public class FileDataSourceProperties extends AbstractDataSourceProperties {
|
public class FileDataSourceProperties extends AbstractDataSourceProperties {
|
||||||
|
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String file;
|
private String file;
|
||||||
private String charset = "utf-8";
|
private String charset = "utf-8";
|
||||||
private long recommendRefreshMs = 3000L;
|
private long recommendRefreshMs = 3000L;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -31,10 +31,10 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
|
|||||||
|
|
||||||
private String serverAddr;
|
private String serverAddr;
|
||||||
|
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String groupId = "DEFAULT_GROUP";
|
private String groupId = "DEFAULT_GROUP";
|
||||||
|
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String dataId;
|
private String dataId;
|
||||||
|
|
||||||
private String endpoint;
|
private String endpoint;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
|
import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ public class ZookeeperDataSourceProperties extends AbstractDataSourceProperties
|
|||||||
super(ZookeeperDataSourceFactoryBean.class.getName());
|
super(ZookeeperDataSourceFactoryBean.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotEmpty
|
@NotNull
|
||||||
private String serverAddr;
|
private String serverAddr;
|
||||||
|
|
||||||
private String path;
|
private String path;
|
||||||
|
@ -20,6 +20,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.cloud.alibaba.sentinel.datasource.config.DataSourcePropertiesConfiguration;
|
import org.springframework.cloud.alibaba.sentinel.datasource.config.DataSourcePropertiesConfiguration;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
@ -55,6 +57,7 @@ public class SentinelProperties {
|
|||||||
/**
|
/**
|
||||||
* Configurations about datasource, like 'nacos', 'apollo', 'file', 'zookeeper'.
|
* Configurations about datasource, like 'nacos', 'apollo', 'file', 'zookeeper'.
|
||||||
*/
|
*/
|
||||||
|
@Valid
|
||||||
private Map<String, DataSourcePropertiesConfiguration> datasource = new TreeMap<>(
|
private Map<String, DataSourcePropertiesConfiguration> datasource = new TreeMap<>(
|
||||||
String.CASE_INSENSITIVE_ORDER);
|
String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user