From 13faebbae09d4f3aab66791bd6bf6e15e85ebadd Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Fri, 23 Feb 2024 13:01:25 +0100 Subject: [PATCH] TMP --- .../chat/backend/ChatBackendApplication.java | 10 +--------- .../MongoDbStorageNotActiveConfiguration.java | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 16 deletions(-) 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 dbd707e4..76debbed 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java @@ -6,19 +6,11 @@ import jakarta.annotation.PreDestroy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -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.web.reactive.config.CorsRegistry; import org.springframework.web.reactive.config.WebFluxConfigurer; -@SpringBootApplication(exclude = { - MongoReactiveDataAutoConfiguration.class, - MongoReactiveAutoConfiguration.class, - MongoReactiveRepositoriesAutoConfiguration.class, - MongoAutoConfiguration.class }) +@SpringBootApplication public class ChatBackendApplication implements WebFluxConfigurer { @Autowired 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 index 91602aa0..67045f34 100644 --- 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 @@ -1,10 +1,13 @@ 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.context.annotation.Bean; +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.context.annotation.Lazy; @ConditionalOnExpression("!'${chat.backend.inmemory.storage-strategy}'.toLowerCase().equals('mongodb')") @@ -12,11 +15,13 @@ import org.springframework.context.annotation.Lazy; @Slf4j public class MongoDbStorageNotActiveConfiguration { - @Bean - @Lazy(false) - public String foo() + @Configuration + @EnableAutoConfiguration(exclude = { + MongoReactiveDataAutoConfiguration.class, + MongoReactiveAutoConfiguration.class, + MongoReactiveRepositoriesAutoConfiguration.class, + MongoAutoConfiguration.class }) + public static class DisableMongoDBConfiguration { - log.info("FOO!"); - return "FOO"; } } -- 2.20.1