升级到 Spring 启动到 2.5.5 会导致 kafka 库出现问题

Upgrading to Spring boot to 2.5.5 creates issue with kafka libraries

我已经将 spring 引导版本从 2.5.3 升级到 2.5.5,这也升级了这个库。

spring-kafka         : from 2.7.4 to 2.7.7
spring-kafka-test    : from 2.7.4 to 2.7.7
kafka-clients        : from 2.7.1 to 2.8.1
spring-test          : from 5.3.9 to 5.3.10

通过这次升级,我开始收到错误消息: java.lang.NoSuchMethodError:kafka.server.KafkaServer.(Lkafka/server/KafkaConfig; Lorg/apache/common/kafka/utils/Time;Lscala/Option;/Lscala/collection/Seq;)V

我已经根据 spring 文档 https://spring.io/projects/spring-kafka

的兼容性矩阵的要求更改了很多版本

知道可能是什么问题吗?

pom.xml (spring-boot 2.5.5)

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka</artifactId>
        <version>2.7.7</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka-test</artifactId>
        <version>2.7.7</version>
    </dependency>
    <dependency>
        <groupId>io.confluent</groupId>
        <artifactId>kafka-connect-replicator</artifactId>
        <version>5.3.4</version>
        <scope>runtime</scope>
        <exclusions>
          <exclusion>
           <groupId>org.apache.kafka</groupId>
           <artifactId>kafka_2.11</artifactId>
          </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>io.confluent</groupId>
        <artifactId>kafka-avro-serializer</artifactId>
        <version>5.5.1</version>
        <exclusions>
          <exclusion>
           <groupId>org.apache.kafka</groupId>
           <artifactId>kafka-clients</artifactId>
          </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <scope>test</scope>
</dependency>

每当您为 kafka-clients 指定版本而不是让引导指定版本时;您还必须覆盖嵌入式代理使用的 kafka 罐子的版本。

https://docs.spring.io/spring-kafka/docs/current/reference/html/#update-deps