From: Kai Moritz Date: Wed, 28 Oct 2020 17:31:56 +0000 (+0100) Subject: FIX: Added missing annotation @EnableScheduling X-Git-Tag: part-2~8 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ef81f7d7d56b67a2084d1a5d3f66c5a3db8fb796;p=demos%2Fkafka%2Foutbox 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 --- 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(); } }