1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00
This commit is contained in:
fangjian0423
2018-12-05 12:45:02 +08:00
parent 0c8bd1b58a
commit 53643b94ce
5 changed files with 44 additions and 38 deletions

View File

@@ -1,12 +1,13 @@
package org.springframework.cloud.alibaba.cloud.examples;
import com.alibaba.csp.sentinel.datasource.Converter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.alibaba.sentinel.annotation.SentinelProtect;
import org.springframework.cloud.alibaba.sentinel.annotation.SentinelRestTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import com.alibaba.csp.sentinel.datasource.Converter;
/**
* @author xiaojing
*/
@@ -14,7 +15,7 @@ import org.springframework.web.client.RestTemplate;
public class ServiceApplication {
@Bean
@SentinelProtect(blockHandler = "handleException", blockHandlerClass = ExceptionUtil.class)
@SentinelRestTemplate(blockHandler = "handleException", blockHandlerClass = ExceptionUtil.class)
public RestTemplate restTemplate() {
return new RestTemplate();
}
@@ -25,9 +26,9 @@ public class ServiceApplication {
}
@Bean
public Converter myConverter() {
return new JsonFlowRuleListConverter();
}
public Converter myConverter() {
return new JsonFlowRuleListConverter();
}
public static void main(String[] args) {
SpringApplication.run(ServiceApplication.class, args);