From: Kai Moritz Date: Fri, 23 Feb 2024 15:19:48 +0000 (+0100) Subject: TMP X-Git-Tag: rebase--2024-02-23--16-28~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=e45a8d8c86eb2737be8462ec7a5a51a7534860e5;p=demos%2Fkafka%2Fchat TMP --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java index d980dd34..76debbed 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java @@ -5,14 +5,7 @@ import de.juplo.kafka.chat.backend.implementation.StorageStrategy; import jakarta.annotation.PreDestroy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; -import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; -import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveRepositoriesAutoConfiguration; -import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; -import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration; -import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.config.CorsRegistry; import org.springframework.web.reactive.config.WebFluxConfigurer; @@ -44,17 +37,6 @@ public class ChatBackendApplication implements WebFluxConfigurer .subscribe(); } - @ConditionalOnExpression("!'${chat.backend.inmemory.storage-strategy}'.toLowerCase().equals('mongodb')") - @Configuration - @EnableAutoConfiguration(exclude = { - MongoReactiveDataAutoConfiguration.class, - MongoReactiveAutoConfiguration.class, - MongoReactiveRepositoriesAutoConfiguration.class, - MongoAutoConfiguration.class }) - public static class DisableMongoDBConfiguration - { - } - public static void main(String[] args) { SpringApplication.run(ChatBackendApplication.class, args); diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java index f49e385b..cdd02154 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java @@ -1,5 +1,11 @@ package de.juplo.kafka.chat.backend; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration; +import org.springframework.boot.autoconfigure.data.mongo.MongoReactiveRepositoriesAutoConfiguration; +import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; +import org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -16,4 +22,16 @@ public class ChatBackendConfiguration { return Clock.systemDefaultZone(); } + + + @ConditionalOnExpression("!'${chat.backend.inmemory.storage-strategy}'.toLowerCase().equals('mongodb')") + @Configuration + @EnableAutoConfiguration(exclude = { + MongoReactiveDataAutoConfiguration.class, + MongoReactiveAutoConfiguration.class, + MongoReactiveRepositoriesAutoConfiguration.class, + MongoAutoConfiguration.class }) + public static class DisableMongoDBConfiguration + { + } }