Share feedback
Answers are generated based on the documentation.

Testing Spring Boot Kafka Listener using Testcontainers

もくじ

Learn how to create a Spring Boot application with a Kafka listener that persists data in MySQL, then test it using Testcontainers Kafka and MySQL modules with Awaitility.
Time to complete 25 分

In this guide, you will learn how to:

  • Create a Spring Boot application with Kafka integration
  • Implement a Kafka listener and persist data in a MySQL database
  • Test the Kafka listener using Testcontainers and Awaitility

Prerequisites

  • Java 17+
  • Maven or Gradle
  • A Docker environment supported by Testcontainers
メモ

If you're new to Testcontainers, visit the Testcontainers overview to learn more about Testcontainers and the benefits of using it.

モジュール

  1. Create the project

    Set up a Spring Boot project with Kafka, Spring Data JPA, and MySQL.

  2. Write tests

    Test the Spring Boot Kafka listener using Testcontainers Kafka and MySQL modules with Awaitility.

  3. Run tests

    Run your Testcontainers-based Spring Boot Kafka integration tests and explore next steps.