1 package de.juplo.kafka.chat.backend;
3 import de.juplo.kafka.chat.backend.domain.ChatHome;
4 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
5 import jakarta.annotation.PreDestroy;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.boot.SpringApplication;
8 import org.springframework.boot.autoconfigure.SpringBootApplication;
9 import org.springframework.web.reactive.config.CorsRegistry;
10 import org.springframework.web.reactive.config.WebFluxConfigurer;
13 @SpringBootApplication
14 public class ChatBackendApplication implements WebFluxConfigurer
17 ChatBackendProperties properties;
21 StorageStrategy storageStrategy;
25 public void addCorsMappings(CorsRegistry registry)
29 .allowedOrigins(properties.getAllowedOrigins());
35 storageStrategy.writeChatrooms(chatHome.list());
38 public static void main(String[] args)
40 SpringApplication.run(ChatBackendApplication.class, args);