Skip to content
Kafka Is Fun

Getting Started · Beginner · Topic 1 of 5

Maven/Gradle Dependencies

Add spring-kafka to your project. Spring Boot's dependency management determines the Apache Kafka client versions, so you do not set them yourself; the kafka.version property overrides them if you need to.

pom.xml (Maven)xml
<dependency>
  <groupId>org.springframework.kafka</groupId>
  <artifactId>spring-kafka</artifactId>
  <!-- Version managed by Spring Boot's dependency management -->
</dependency>

<!-- For Avro + Schema Registry (optional): Confluent's serializers, not part of Spring or Kafka.
     Use the artifact version and repository from Confluent's documentation for your Platform release. -->
<dependency>
  <groupId>io.confluent</groupId>
  <artifactId>kafka-avro-serializer</artifactId>
</dependency>
build.gradle (Gradle)groovy
dependencies {
    implementation 'org.springframework.kafka:spring-kafka'
    // Needed only if you use Kafka Streams
    implementation 'org.apache.kafka:kafka-streams'
    // Test utilities (embedded broker)
    testImplementation 'org.springframework.kafka:spring-kafka-test'
}

Sources

Checked against Spring for Apache Kafka 4.1.1, Spring Boot 4.1.1 and Kafka 4.2 documentation on 11 October 2026. Draft: not yet reviewed by a Kafka specialist, and releases move on, so confirm against the current documentation before you act on it.