You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot构建报错:spring-cloud-starter-netflix-hystrix依赖版本缺失

问题解决:添加Hystrix依赖时版本缺失报错

问题原因

你使用的Spring Cloud版本是2021.0.3(Jubilee),这个版本属于Spring Cloud 2021.x系列,而Netflix Hystrix已经在Spring Cloud 2020.0.0(Ilford)版本后被正式移除,不再包含在spring-cloud-dependencies的依赖管理中,所以Maven无法自动获取该依赖的版本号,导致构建报错。

解决方案

方案1:使用官方推荐的Resilience4j替代(推荐)

Hystrix已经停止维护,Spring官方推荐使用Resilience4j作为断路器组件,它和Spring Cloud Gateway兼容性更好。在pom.xml中替换Hystrix依赖为:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
</dependency>

添加后,Maven会通过你已有的spring-cloud-dependencies自动管理版本,无需手动指定。

方案2:手动指定Hystrix版本(不推荐,仅作兼容参考)

如果一定要继续使用Hystrix,需要手动给依赖添加版本号,注意版本要和你的Spring Boot/Spring Cloud版本兼容。例如:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    <version>2.2.10.RELEASE</version>
</dependency>

注意:该版本仅适配Spring Boot 2.7.x系列,后续可能会出现兼容性问题,且Hystrix已停止维护,不建议长期使用。

内容的提问来源于stack exchange,提问作者Yasas Ranawaka

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.23 13:27:18