From 24e36e397696d0b42e3f87e9b45fbc49d6d80c5d Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 23 Feb 2024 15:38:25 +0100 Subject: [PATCH] TMP --- .../chat/backend/ChatBackendApplication.java | 18 +++++++++++++ .../MongoDbStorageNotActiveConfiguration.java | 27 ------------------- 2 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java 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 76debbed..d980dd34 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java @@ -5,7 +5,14 @@ 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; @@ -37,6 +44,17 @@ 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/storage/mongodb/MongoDbStorageNotActiveConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java deleted file mode 100644 index 67045f34..00000000 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java +++ /dev/null @@ -1,27 +0,0 @@ -package de.juplo.kafka.chat.backend.storage.mongodb; - -import lombok.extern.slf4j.Slf4j; -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.context.annotation.Configuration; - - -@ConditionalOnExpression("!'${chat.backend.inmemory.storage-strategy}'.toLowerCase().equals('mongodb')") -@Configuration -@Slf4j -public class MongoDbStorageNotActiveConfiguration -{ - @Configuration - @EnableAutoConfiguration(exclude = { - MongoReactiveDataAutoConfiguration.class, - MongoReactiveAutoConfiguration.class, - MongoReactiveRepositoriesAutoConfiguration.class, - MongoAutoConfiguration.class }) - public static class DisableMongoDBConfiguration - { - } -} -- 2.20.1