新版本openFeign 移除了ribbon 和hystrix支持,你掉进去过吗?

2,089 阅读1分钟

集成hystrix的时候 各种论坛帖都说openfeign自带了,然而在最新版本中已经移除了。当前对比的版本是v2.2.0.RELEASE...v3.0.1

github.com/spring-clou…

新版本的spring-cloud-starter-openfeign中 需要单独引入hystrix 依赖

我使用的版本号如下:

spring-cloud-starter-openfeign 3.0.1
spring-cloud-starter-netflix-hystrix 2.2.7.RELEASE

引入依赖后,在AppApplication入口文件增加@EnableHystrix注解 然后在application.yml中增加配置

最后,在feign调用的地方编写对应的fallback就可以了,我这里使用的是fallbackFactory

填坑完毕,记录一下