FIX: Added missing annotation @EnableScheduling
authorKai Moritz <kai@juplo.de>
Wed, 28 Oct 2020 17:31:56 +0000 (18:31 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 16 May 2021 15:48:48 +0000 (17:48 +0200)
* 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

outbox/src/main/java/de/juplo/kafka/outbox/Application.java

index a63d714..678a48a 100644 (file)
@@ -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();
   }
 }