Refaktorisierung für Tests - Start des EndlessConsumer in ApplicationRunner
[demos/kafka/training] / src / main / java / de / juplo / kafka / Application.java
1 package de.juplo.kafka;
2
3 import lombok.extern.slf4j.Slf4j;
4 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.boot.ApplicationArguments;
6 import org.springframework.boot.ApplicationRunner;
7 import org.springframework.boot.SpringApplication;
8 import org.springframework.boot.autoconfigure.SpringBootApplication;
9
10
11 @SpringBootApplication
12 @Slf4j
13 public class Application implements ApplicationRunner
14 {
15   @Autowired
16   EndlessConsumer endlessConsumer;
17
18
19   @Override
20   public void run(ApplicationArguments args) throws Exception
21   {
22     log.info("Starting EndlessConsumer");
23     endlessConsumer.start();
24   }
25
26
27   public static void main(String[] args)
28   {
29     SpringApplication.run(Application.class, args);
30   }
31 }