fix: Supressed mongo-autoconfiguration if `FilesStorageStrategy` is active
authorKai Moritz <kai@juplo.de>
Thu, 12 Jan 2023 21:58:56 +0000 (22:58 +0100)
committerKai Moritz <kai@juplo.de>
Wed, 25 Jan 2023 20:59:37 +0000 (21:59 +0100)
src/main/java/de/juplo/kafka/chat/backend/persistence/storage/files/FilesStorageConfiguration.java

index ae6af2f..31e285c 100644 (file)
@@ -4,7 +4,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import de.juplo.kafka.chat.backend.ChatBackendProperties;
 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
 import de.juplo.kafka.chat.backend.persistence.inmemory.InMemoryChatRoomService;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration;
+import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 
@@ -18,6 +21,10 @@ import java.time.Clock;
     havingValue = "files",
     matchIfMissing = true)
 @Configuration
+@EnableAutoConfiguration(
+    exclude = {
+        MongoRepositoriesAutoConfiguration.class,
+        MongoAutoConfiguration.class })
 public class FilesStorageConfiguration
 {
   @Bean