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>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
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.RuleType;
|
||||
@ -37,7 +36,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
*/
|
||||
public class AbstractDataSourceProperties {
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String dataType = "json";
|
||||
@NotNull
|
||||
private RuleType ruleType;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
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;
|
||||
|
||||
@ -28,9 +28,9 @@ import org.springframework.cloud.alibaba.sentinel.datasource.factorybean.ApolloD
|
||||
*/
|
||||
public class ApolloDataSourceProperties extends AbstractDataSourceProperties {
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String namespaceName;
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String flowRulesKey;
|
||||
private String defaultFlowRuleValue;
|
||||
|
||||
|
@ -4,6 +4,8 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
@ -19,12 +21,16 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
*/
|
||||
public class DataSourcePropertiesConfiguration {
|
||||
|
||||
@Valid
|
||||
private FileDataSourceProperties file;
|
||||
|
||||
@Valid
|
||||
private NacosDataSourceProperties nacos;
|
||||
|
||||
@Valid
|
||||
private ZookeeperDataSourceProperties zk;
|
||||
|
||||
@Valid
|
||||
private ApolloDataSourceProperties apollo;
|
||||
|
||||
public DataSourcePropertiesConfiguration() {
|
||||
|
@ -18,7 +18,7 @@ package org.springframework.cloud.alibaba.sentinel.datasource.config;
|
||||
|
||||
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.util.ResourceUtils;
|
||||
@ -32,7 +32,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class FileDataSourceProperties extends AbstractDataSourceProperties {
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String file;
|
||||
private String charset = "utf-8";
|
||||
private long recommendRefreshMs = 3000L;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
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.util.StringUtils;
|
||||
@ -31,10 +31,10 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
|
||||
|
||||
private String serverAddr;
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String groupId = "DEFAULT_GROUP";
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String dataId;
|
||||
|
||||
private String endpoint;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
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;
|
||||
|
||||
@ -32,7 +32,7 @@ public class ZookeeperDataSourceProperties extends AbstractDataSourceProperties
|
||||
super(ZookeeperDataSourceFactoryBean.class.getName());
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
@NotNull
|
||||
private String serverAddr;
|
||||
|
||||
private String path;
|
||||
|
@ -20,6 +20,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.alibaba.sentinel.datasource.config.DataSourcePropertiesConfiguration;
|
||||
import org.springframework.core.Ordered;
|
||||
@ -55,6 +57,7 @@ public class SentinelProperties {
|
||||
/**
|
||||
* Configurations about datasource, like 'nacos', 'apollo', 'file', 'zookeeper'.
|
||||
*/
|
||||
@Valid
|
||||
private Map<String, DataSourcePropertiesConfiguration> datasource = new TreeMap<>(
|
||||
String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user