TMP
[demos/kafka/chat] / src / main / java / de / juplo / kafka / chat / backend / storage / nostorage / NoStorageStorageConfiguration.java
1 package de.juplo.kafka.chat.backend.storage.nostorage;
2
3 import de.juplo.kafka.chat.backend.implementation.StorageStrategy;
4 import lombok.extern.slf4j.Slf4j;
5 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6 import org.springframework.context.annotation.Bean;
7 import org.springframework.context.annotation.Configuration;
8 import org.springframework.context.annotation.Lazy;
9
10
11 @ConditionalOnProperty(
12     prefix = "chat.backend.inmemory",
13     name = "storage-strategy",
14     havingValue = "none",
15     matchIfMissing = true)
16 @Configuration
17 @Slf4j
18 public class NoStorageStorageConfiguration
19 {
20   @Bean
21   public StorageStrategy storageStrategy()
22   {
23     return new NoStorageStorageStrategy();
24   }
25
26   @Bean
27   @Lazy(false)
28   public String foo()
29   {
30     log.info("FOO (woanders)!");
31     return "FOO";
32   }
33 }