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

添加feign-client依赖后Spring Boot应用启动失败该如何处理?

问题根因
  • 你引入的spring-cloud-starter-feign:1.4.7.RELEASE属于Spring Cloud Edgware版本族,该版本仅适配Spring Boot 1.5.x系列,和你使用的Spring Boot 2.4.x、2.5.x版本完全不兼容。
  • Spring Boot 2.0版本重构了web相关自动配置类的包路径,旧版Feign Starter强依赖的org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.class在2.0及以上版本中已经被迁移到org.springframework.boot.autoconfigure.web.servlet路径下,旧版本组件检索原路径的类自然会抛出文件不存在的异常。
解决方案
  1. 废弃已停止维护的旧版Feign Starter坐标,改用Spring Cloud官方后续迭代的OpenFeign Starter。首先在pom.xml中引入和你当前Spring Boot版本匹配的Spring Cloud依赖管理:
    • Spring Boot 2.4.x对应Spring Cloud 2020.0.x版本族
    • Spring Boot 2.5.x对应Spring Cloud 2021.0.x版本族
      以Spring Boot 2.5.x为例,依赖管理配置如下:
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>2021.0.5</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
  1. 替换原有Feign依赖为如下坐标,无需手动指定版本,由依赖管理统一控制版本匹配,避免兼容问题:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.03 02:06:02