Search code examples
spring-bootspring-kafka

Spring-Kafka: RecordIntercepter class not found


I am using spring boot 2.1.5 and spring-kafka, version not specified. Project is gradle 6.0, java 1.8

I am getting this error

error creating bean with name 'org.springframework.boot.autoconfigure.kafka.kafkaannotationdrivenconfiguration': unexpected exception during bean creation; nested exception is java.lang.typenotpresentexception: type org.springframework.kafka.listener.recordinterceptor not present

What could be this due to? Please help.


Solution

  • 2.1.5 is nearly a year old; the current Boot 2.1.x release is 2.1.13.

    2.1.5 uses spring-kafka 2.2.6 so I don't see how you can get that error, based on your description.

    RecordInterceptor was added in spring-kafka 2.2.7.

    It was added to the Spring Boot autoconfiguration in 2.2.0.

    So what you are describing makes no sense; you must be using Boot 2.2.x and an old spring-kafka version.

    You have mis-matched Boot/Kafka versions.

    Upgrade to Boot 2.1.13 (or preferably 2.2.6).