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

Spring Boot 3.1.0-M1及以上版本不支持Spring Cloud Config?

问题解决:Spring Boot 3.1.0-M1无法选择Config Server的替代方案

原因说明

Spring Initializr的依赖版本匹配规则是基于Spring官方维护的Spring Cloud与Spring Boot版本映射关系。当你选择Spring Boot 3.1.0-M1这个早期里程碑版本时,对应的Spring Cloud适配版本尚未发布,导致Initializr里的Config Server依赖版本范围还未更新,所以呈现灰色不可选状态。

替代方案

  • 手动添加Config Server依赖
    跳过Initializr的依赖选择,直接在项目的构建文件中手动引入依赖,同时指定适配Spring Boot 3.1.0-M1的Spring Cloud BOM:

    • Maven项目(pom.xml):
      先在dependencyManagement中引入Spring Cloud依赖管理BOM:
      <dependencyManagement>
          <dependencies>
              <dependency>
                  <groupId>org.springframework.cloud</groupId>
                  <artifactId>spring-cloud-dependencies</artifactId>
                  <version>2022.0.0-M6</version> <!-- 该版本适配Spring Boot 3.1.x里程碑版 -->
                  <type>pom</type>
                  <scope>import</scope>
              </dependency>
          </dependencies>
      </dependencyManagement>
      
      再添加Config Server核心依赖:
      <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-config-server</artifactId>
      </dependency>
      
    • Gradle项目(build.gradle):
      dependencyManagement {
          imports {
              mavenBom "org.springframework.cloud:spring-cloud-dependencies:2022.0.0-M6"
          }
      }
      
      dependencies {
          implementation 'org.springframework.cloud:spring-cloud-config-server'
      }
      
      注意:如果2022.0.0-M6不兼容,可去Spring Cloud官方渠道查看最新的适配里程碑版本。
  • 等待Spring Cloud适配版本发布
    Spring Cloud团队会在Spring Boot里程碑版本发布后,跟进推出对应的适配里程碑版本。待适配版本发布后,Initializr会自动更新依赖范围,即可正常选择Config Server。

  • 临时降级Spring Boot版本
    若不需要必须使用3.1.0-M1,可降级到Spring Boot 3.0.x稳定版(如3.0.6),该版本对应的Spring Cloud 2022.0.x是稳定版,Initializr里的Config Server依赖可正常选择。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 07:07:33