Spring Batch Kafka with SASL_PLAINTEXT

It took me a while to find and did need a combination of multiple sources to get Spring Batch Kafka working with SASL_PLAINTEXT authentication. So let me show you how I did it. Keep in mind it is just a starting configuration so you get a connection working.

application.yaml

spring:
  kafka:
    bootstrap-servers: <kafka host>:9092
    properties:
      sasl:
        jaas.config: com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true keyTab="C:/dev/my.keytab" principal="[email protected]";
        mechanism: GSSAPI
        kerberos:
          service:
            name: kafka
      security.protocol: SASL_PLAINTEXT
    consumer:
      value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer
      key-deserializer: org.apache.kafka.common.serialization.LongDeserializer
      group-id: <groupId>
      properties.spring.json.trusted.packages: '*'
    template.default-topic: <topic>