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

Spring Boot 2.7.9兼容的spring-kafka版本咨询

Spring Boot 2.7.9 兼容的 spring-kafka 版本

出现java.lang.NoSuchMethodError是因为spring-kafka 3.0.5 适配的是 Spring Boot 3.x 版本,和 Spring Boot 2.7.9 存在兼容性冲突——setOnlyLogRecordMetadata方法是 spring-kafka 3.0.x 新增的,但 Spring Boot 2.7.9 的 Kafka 自动配置逻辑依赖低版本 API,导致方法找不到。

Spring Boot 2.7.x 系列对应的兼容 spring-kafka 版本为 2.8.x,针对 2.7.9 最匹配的具体版本是 2.8.11。

解决方式:

  • 直接移除依赖中手动指定的 spring-kafka:3.0.5 版本号,让 Spring Boot 的依赖管理机制自动引入兼容版本
  • 若需手动指定版本,将依赖改为:
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka</artifactId>
        <version>2.8.11</version>
    </dependency>
    

内容的提问来源于stack exchange,提问作者Marc Le Bihan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.23 12:47:03