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;
11 import reactor.core.publisher.Flux;
14 @SpringBootApplication
15 public class ChatBackendApplication implements WebFluxConfigurer
18 ChatBackendProperties properties;
22 StorageStrategy storageStrategy;
26 public void addCorsMappings(CorsRegistry registry)
30 .allowedOrigins(properties.getAllowedOrigins());
36 storageStrategy.writeChatrooms(Flux.fromStream(chatHome.list()));
39 public static void main(String[] args)
41 SpringApplication.run(ChatBackendApplication.class, args);