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

如何快速找到匹配当前JDK版本的Jar包并降级spring-cloud-config-server?

降级Spring Cloud Config Server适配JDK15的操作步骤

1. 确定兼容版本范围

Spring Cloud的版本与JDK支持度强绑定:

  • 2021.0.x及以上版本要求JDK17+,不符合你的需求;
  • 2020.0.x系列(代号Ilford)支持JDK8到JDK16,刚好适配JDK15,对应的Spring Boot版本建议选2.4.x~2.5.x区间,避免版本冲突。

2. 在Maven依赖中指定具体版本

修改你的pom.xml依赖,添加兼容的版本号,示例如下:

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
        <version>3.0.5</version> <!-- 属于2020.0.x系列,兼容JDK15 -->
    </dependency>
</dependencies>

如果项目已引入Spring Boot父依赖,也可以通过Spring Cloud依赖管理统一控制版本,无需单独指定:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>2020.0.6</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

配置后,config server会自动匹配对应系列的兼容版本。

3. 验证版本有效性

修改完成后,在IDEA中执行mvn clean install,让Maven拉取对应版本的依赖包。启动项目后,检查是否出现UnsupportedClassVersionError这类JDK版本不兼容报错,无报错则说明适配成功。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.12 22:05:20