TMP
authorKai Moritz <kai@juplo.de>
Fri, 23 Feb 2024 15:19:48 +0000 (16:19 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 23 Feb 2024 15:19:48 +0000 (16:19 +0100)
src/main/java/de/juplo/kafka/chat/backend/ChatBackendApplication.java
src/main/java/de/juplo/kafka/chat/backend/ChatBackendConfiguration.java

index d980dd3..76debbe 100644 (file)
@@ -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);
index f49e385..cdd0215 100644 (file)
@@ -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
+  {
+  }
 }