package com.iplatform.chat.config; import com.iplatform.chat.ChatSessionCache; import com.iplatform.chat.cache.RedisChatSessionCache; import com.iplatform.chat.service.ChatDialogServiceImpl; import com.iplatform.core.PlatformConfiguration; import com.walker.support.redis.RedisHelper; import com.walker.support.redis.cache.RedisCacheProvider; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration @ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false) @ConditionalOnClass({RedisCacheProvider.class}) @AutoConfigureAfter(RedisAutoConfiguration.class) public class RedisChatCacheConfig extends PlatformConfiguration { @Bean public ChatSessionCache chatSessionCache(RedisHelper redisHelper, ChatDialogServiceImpl chatDialogService){ RedisChatSessionCache cache = new RedisChatSessionCache(); cache.setRedisHelper(redisHelper); cache.setChatDialogService(chatDialogService); return cache; } }