本人机器全部依赖如下
springboot 2.5.5 springcloud 2020.0.4
遇到的问题4.0.0 org.springframework.boot spring-boot-starter-parent 2.5.5 com.example.springcloud book 0.0.1-SNAPSHOT book Demo project for Spring Boot 1.8 2020.0.4 org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-web org.springframework.cloud spring-cloud-starter-config org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-starter-bootstrap 3.0.2 org.springframework.cloud spring-cloud-starter-openfeign org.springframework.cloud spring-cloud-starter-netflix-hystrix 2.2.1.RELEASE org.springframework.cloud spring-cloud-config-client
使用openfeign的Hytrix断路器配置无效,无法降级。
问题初步排查# 启动feign中的hystrix组件
feign:
circuitbreaker: //springcloud 2020版本应将Hytrix修改为circuitbreaker
#开启feign的hystrix支持,默认是false
enabled: true
springcloud 2020版本应将Hytrix修改为circuitbreaker,我修改后yml文件内报错消失,但是Hytrix功能仍不可用。
后根据网络上添加了netflix-hystrix新依赖,并在主类开启@EnableHystrix
仍不可用。
附上我的业务实现代码
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "member",fallback = MemberClient.MemberClientFallBack.class)
public interface MemberClient {
@GetMapping("/check")
public MemberResult checkMobile(@RequestParam("mobile") String mobile);
@Component
static class MemberClientFallBack implements MemberClient{
@Override
public MemberResult checkMobile(String mobile) {
MemberResult mr = new MemberResult();
mr.setCode("0");
mr.setMessage("success");
return mr;
}
}
}
目前状况就是无法进入MemberClientFallBack 实现类,实现断路降级功能。
还有一张图附一下,不知道有没有关系,关于Enablecircuitbreker弃用的问题
求路过的各位大佬,不吝赐教!!!不胜感激,我会积极回复消息,并提供补充。


![[求解决] 启动feign中的hystrix组件遇到问题 [求解决] 启动feign中的hystrix组件遇到问题](http://www.mshxw.com/aiimages/31/274936.png)
