From: Kai Moritz Date: Wed, 11 Jan 2023 21:12:12 +0000 (+0100) Subject: refactor: Moved base-configuration into separate package -- Move X-Git-Tag: wip-config-package~2 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=1dda8bbfd8613abb1883a38c743684c998f0cd7a;p=demos%2Fkafka%2Fchat refactor: Moved base-configuration into separate package -- Move --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java deleted file mode 100644 index 10e9d37b..00000000 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -package de.juplo.kafka.chat.backend; - -import de.juplo.kafka.chat.backend.domain.ChatHome; -import de.juplo.kafka.chat.backend.domain.ChatHomeService; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.time.Clock; - - -@Configuration -@EnableConfigurationProperties(ChatBackendProperties.class) -public class ChatBackendConfiguration -{ - @Bean - public ChatHome chatHome(ChatHomeService chatHomeService) - { - return new ChatHome(chatHomeService); - } - - @Bean - public Clock clock() - { - return Clock.systemDefaultZone(); - } -} diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java deleted file mode 100644 index 48e58165..00000000 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java +++ /dev/null @@ -1,18 +0,0 @@ -package de.juplo.kafka.chat.backend; - -import lombok.Getter; -import lombok.Setter; -import org.springframework.boot.context.properties.ConfigurationProperties; - -import java.nio.file.Paths; - - -@ConfigurationProperties("chat.backend") -@Getter -@Setter -public class ChatBackendProperties -{ - private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString(); - private String allowedOrigins = "http://localhost:4200"; - private int chatroomBufferSize = 8; -} diff --git a/src/main/java/de/juplo/kafka/chat/backend/config/ChatBackendConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/config/ChatBackendConfiguration.java new file mode 100644 index 00000000..10e9d37b --- /dev/null +++ b/src/main/java/de/juplo/kafka/chat/backend/config/ChatBackendConfiguration.java @@ -0,0 +1,27 @@ +package de.juplo.kafka.chat.backend; + +import de.juplo.kafka.chat.backend.domain.ChatHome; +import de.juplo.kafka.chat.backend.domain.ChatHomeService; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.time.Clock; + + +@Configuration +@EnableConfigurationProperties(ChatBackendProperties.class) +public class ChatBackendConfiguration +{ + @Bean + public ChatHome chatHome(ChatHomeService chatHomeService) + { + return new ChatHome(chatHomeService); + } + + @Bean + public Clock clock() + { + return Clock.systemDefaultZone(); + } +} diff --git a/src/main/java/de/juplo/kafka/chat/backend/config/ChatBackendProperties.java b/src/main/java/de/juplo/kafka/chat/backend/config/ChatBackendProperties.java new file mode 100644 index 00000000..48e58165 --- /dev/null +++ b/src/main/java/de/juplo/kafka/chat/backend/config/ChatBackendProperties.java @@ -0,0 +1,18 @@ +package de.juplo.kafka.chat.backend; + +import lombok.Getter; +import lombok.Setter; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.nio.file.Paths; + + +@ConfigurationProperties("chat.backend") +@Getter +@Setter +public class ChatBackendProperties +{ + private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString(); + private String allowedOrigins = "http://localhost:4200"; + private int chatroomBufferSize = 8; +}