Search code examples
spring-bootspring-kafkajunit5spring-boot-testspring-kafka-test

Update spring-kafka-test to 2.2.x but still use old kafka-client 1.1.1 with junit5 and spring boot 2


I am currently using spring boot 2 and junit 5. I want to make use of spring-kafka-test for testing, however the version of spring-kafka that I use is 2.1.8.RELEASE. With this I believe its not possible to use EmbeddedKafkaBroker since that is something that came in 2.2.x.

The kafka-client that I use is 1.1.0. I looked at the compatibility matrix as mentioned in https://spring.io/projects/spring-kafka it seems its not going to work with client 1.1.0, just wondering if its possible to update just the spring-kafka-test to 2.2.3.RELEASE to use EmbeddedKafkaBrokerwith Junit 5 while still using old kafka-client 1.1.0.

Has anyone tried something like that?


Solution

  • Why not just upgrade everything to 2.2.3? You can use the 2.0.1 client with older brokers.

    The 2.2.3 test jar might work with 2.1.x, but you will probably need the 2.0.1 clients.

    JUnit 5 can be used with spring-kafka-test 2.1.x, but you need the jupiter vintage jar on the class path because the broker has a dependency on some JUnit4 classes.

    See the discussion on this issue.