From: Kai Moritz Date: Fri, 23 Feb 2024 11:42:34 +0000 (+0100) Subject: TMP X-Git-Tag: rebase--2024-02-23--16-28~9 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=12f4f86b94e9947af42a13ea4779c67687071eb5;p=demos%2Fkafka%2Fchat TMP --- 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 new file mode 100644 index 00000000..18ec2416 --- /dev/null +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageNotActiveConfiguration.java @@ -0,0 +1,22 @@ +package de.juplo.kafka.chat.backend.storage.mongodb; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + + +@ConditionalOnExpression("#{${chat.backend.inmemory.storage-strategy} != 'mongodb'}") +@Configuration +@Slf4j +public class MongoDbStorageNotActiveConfiguration +{ + @Bean + @Lazy(false) + public String foo() + { + log.info("FOO!"); + return "FOO"; + } +} diff --git a/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java index d497d957..47e59783 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/storage/nostorage/NoStorageStorageConfiguration.java @@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; @ConditionalOnProperty( @@ -22,12 +21,4 @@ public class NoStorageStorageConfiguration { return new NoStorageStorageStrategy(); } - - @Bean - @Lazy(false) - public String foo() - { - log.info("FOO (woanders)!"); - return "FOO"; - } } diff --git a/src/test/java/de/juplo/kafka/chat/backend/MongoDbStorageNotActiveConfiguration.java b/src/test/java/de/juplo/kafka/chat/backend/MongoDbStorageNotActiveConfiguration.java deleted file mode 100644 index 47d4c7d8..00000000 --- a/src/test/java/de/juplo/kafka/chat/backend/MongoDbStorageNotActiveConfiguration.java +++ /dev/null @@ -1,20 +0,0 @@ -package de.juplo.kafka.chat.backend; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; - - -@Configuration -@Slf4j -public class MongoDbStorageNotActiveConfiguration -{ - @Bean - @Lazy(false) - public String foo() - { - log.info("FOO!"); - return "FOO"; - } -}