From ef81f7d7d56b67a2084d1a5d3f66c5a3db8fb796 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 28 Oct 2020 18:31:56 +0100 Subject: [PATCH] FIX: Added missing annotation @EnableScheduling * The application did not do anything, because scheduling was not activated * Adding @EnableScheduling also keeps the application alive * Therefore, waiting on the CountDownLatch is not needed any more --- .../de/juplo/kafka/outbox/Application.java | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/outbox/src/main/java/de/juplo/kafka/outbox/Application.java b/outbox/src/main/java/de/juplo/kafka/outbox/Application.java index a63d714..678a48a 100644 --- a/outbox/src/main/java/de/juplo/kafka/outbox/Application.java +++ b/outbox/src/main/java/de/juplo/kafka/outbox/Application.java @@ -1,36 +1,18 @@ package de.juplo.kafka.outbox; -import lombok.extern.slf4j.Slf4j; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; - -import java.util.concurrent.CountDownLatch; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @EnableConfigurationProperties(ApplicationProperties.class) -@Slf4j +@EnableScheduling public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); - - final CountDownLatch closeLatch = new CountDownLatch(1); - - Runtime - .getRuntime() - .addShutdownHook(new Thread() - { - @Override - public void run() - { - log.info("Closing application..."); - closeLatch.countDown(); - } - }); - - closeLatch.await(); } } -- 2.20.1