From 5bf794a0d2c7dd49c68161e941e1bd972a6af824 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 13 Aug 2022 19:08:49 +0200 Subject: [PATCH] =?utf8?q?Validierung=20f=C3=BCr=20ApplicationProperties?= =?utf8?q?=20aktiviert?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++++ .../de/juplo/kafka/ApplicationProperties.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pom.xml b/pom.xml index e4d24bb..e7ea677 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,10 @@ spring-boot-configuration-processor true + + org.springframework.boot + spring-boot-starter-validation + org.apache.kafka kafka-clients diff --git a/src/main/java/de/juplo/kafka/ApplicationProperties.java b/src/main/java/de/juplo/kafka/ApplicationProperties.java index c74f588..673613a 100644 --- a/src/main/java/de/juplo/kafka/ApplicationProperties.java +++ b/src/main/java/de/juplo/kafka/ApplicationProperties.java @@ -4,17 +4,33 @@ import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + + @ConfigurationProperties(prefix = "producer") @Getter @Setter public class ApplicationProperties { + @NotNull + @NotEmpty private String bootstrapServer; + @NotNull + @NotEmpty private String clientId; + @NotNull + @NotEmpty private String topic; private Integer partition; + @NotNull + @NotEmpty private String acks; + @NotNull private Integer batchSize; + @NotNull private Integer lingerMs; + @NotNull + @NotEmpty private String compressionType; } -- 2.20.1