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

update sentinel version to 0.2.0

This commit is contained in:
flystar32
2018-10-11 22:03:26 +08:00
parent b9710ada46
commit c8d911e89b
9 changed files with 307 additions and 305 deletions

View File

@@ -2,7 +2,7 @@ package org.springframework.cloud.alibaba.cloud.examples;
import java.util.List;
import com.alibaba.csp.sentinel.datasource.ConfigParser;
import com.alibaba.csp.sentinel.datasource.Converter;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
@@ -10,9 +10,10 @@ import com.alibaba.fastjson.TypeReference;
/**
* @author fangjian
*/
public class JsonFlowRuleListParser implements ConfigParser<String, List<FlowRule>> {
public class JsonFlowRuleListParser implements Converter<String, List<FlowRule>> {
@Override
public List<FlowRule> parse(String source) {
return JSON.parseObject(source, new TypeReference<List<FlowRule>>() {});
public List<FlowRule> convert(String source) {
return JSON.parseObject(source, new TypeReference<List<FlowRule>>() {
});
}
}

View File

@@ -6,7 +6,7 @@ import org.springframework.cloud.alibaba.sentinel.annotation.SentinelProtect;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import com.alibaba.csp.sentinel.datasource.ConfigParser;
import com.alibaba.csp.sentinel.datasource.Converter;
/**
* @author xiaojing
@@ -26,7 +26,7 @@ public class ServiceApplication {
}
@Bean
public ConfigParser myParser() {
public Converter myParser() {
return new JsonFlowRuleListParser();
}