SpringCloud Finchley.SR1版本 在feign 上使用 hystrix
2018-10-03 17:25
525 查看
SpringCloud Finchley.SR1版本 在feign 上使用 hystrix
一.Feign client 中加入hystrix的 fallaback。
@FeignClient(value = “usercenter-client”,fallback = UserCenteriServiceHystric.class)
public interface UserCenterService {
@GetMapping(“hello”)
String consumer();
}
二 编写 UserCenterServiceHystric.Class
@Component
public class UserCenteriServiceHystric implements UserCenterService {
@Override
public String consumer() {
return “sorry 请求用户中心信息异常”;
}
}
三.启动类中添加注解
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
@EnableAutoConfiguration
@EnableCircuitBreaker
public class OrangeMarketApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(OrangeMarketApplication.class).web(true).run();
}
}
相关文章推荐
- 玩转SpringCloud(F版本) 三.断路器(Hystrix)RestTemplate+Ribbon和Feign两种方式
- Spring Cloud 的 Hystrix 在 Feign上使用 Hystrix功能
- SpringCloud[Finchley版本]的feign开启熔断不起作用解决
- SpringCloud 学习 | 第六篇: feign断路器使用(hystrix)
- 关于Dalston.SR3版本的spring cloud,用feign客户端调用服务hystrix不能生效的问题
- spring cloud hystrix在普通应用和feign上使用
- 关于在Spring Cloud Feign工程中使用Hystrix配置不生效的问题
- 第十七章 Spring cloud +Feign+Hystrix+fallbackFactory的使用
- 使用Spring Cloud Feign作为HTTP客户端调用远程HTTP服务
- SPRINGCLOUD(EUREKA+RIBBON+FEIGN+HYSTRIX)
- Spring Cloud feign使用
- 使用Spring Cloud Feign作为HTTP客户端调用远程HTTP服务
- 使用Spring Cloud Feign作为HTTP客户端调用远程HTTP服务
- Spring Cloud Feign 使用方式
- spring cloud feign hystrix doesn't work
- 关于在Spring Cloud Feign工程中使用Ribbon配置不生效的问题
- (八)SpringBoot+SpringCloud —— 使用Feign消费服务
- Spring Cloud Netflix 教程(Feign+Ribbon+Hystrix)
- spring cloud 之 Feign 使用HTTP请求远程服务