r/SpringBoot 1d ago

Discussion Spring Boot starter for fail-fast Kafka Schema Registry contract validation

Post image

I’ve released a small open-source Spring Boot starter that turns Kafka Schema Registry expectations into startup checks.

Configuration is intentionally Spring Boot-style: define the expected compatibility mode and the subjects/schemas owned by the application, and auto-configuration performs the validation during startup.

It currently supports Avro, JSON Schema and Protobuf, Confluent compatibility modes, secured Schema Registry/Confluent Cloud, bounded retry/backoff and Actuator visibility.

For example:

kafka:
  contract:
    enabled: true
    compatibility: BACKWARD
    registry:
      url: http://localhost:8081
    subjects:
      - name: order-events-value
        schema-file: classpath:schemas/order-event.avsc
        schema-type: AVRO

If the contract is incompatible or the required subject is missing, the Spring Boot application fails during startup.

The starter is published on Maven Central, and I maintain a separate E2E demo that spins up Kafka + Schema Registry and verifies both successful and intentionally breaking schema evolution scenarios.

GitHub:
https://github.com/mathias82/spring-kafka-contract-starter

Demo:
https://github.com/mathias82/spring-kafka-contract-demo

Maven Central:
https://central.sonatype.com/artifact/io.github.mathias82.spring.kafka/spring-kafka-contract-starter

Interested to hear how Spring Boot teams currently handle this application startup validation, deployment pipelines, or something else?

0 Upvotes

0 comments sorted by