Spring Cloud环境下Hystrix高可用保护实践.pdfVIP

  • 2
  • 0
  • 约5.01千字
  • 约 6页
  • 2026-07-17 发布于北京
  • 举报

Spring Cloud环境下Hystrix高可用保护实践.pdf

我们其实在springcloud的环境中,肯定是结合feign来使用hystrix的,我们肯定不会直接

自己手动去创建一个HystrixCommand

pom.xml

dependency

groupIdorg.springframework.cloud/groupId

artifactIdspring-cloud-starter-hystrix/artifactId

/dependency

application.yml

feign:

hystrix:

enabled:true

Application启动类

@EnableCircuitBreaker

在feign接口中加入hystrix的降级机制

@FeignClient(name=“ServiceA”,fallback=ServiceAFallback.class)

publicinterfaceServiceAClientextendsServiceAInterface{

staticclassServiceAFallbackimplementsServiceAClient{

publicStringsayHello(){

文档评论(0)

1亿VIP精品文档

相关文档