package com.kx.config; import com.kx.utils.idempotent.impl.RedisTokenCache; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.core.RedisOperations; import org.springframework.data.redis.core.StringRedisTemplate; /** * redis引入,工具类使用redis相关的配置 * * @author kongxiang */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(RedisOperations.class) @AutoConfigureAfter(org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration.class) public class RedisAutoConfiguration { @Bean @ConditionalOnBean(RedisOperations.class) public RedisTokenCache redisTokenCache(StringRedisTemplate stringRedisTemplate) { return new RedisTokenCache(stringRedisTemplate); } }