org.zodiac.autoconfigure.redis.RedisCacheManagerAutoConfiguration Maven / Gradle / Ivy
package org.zodiac.autoconfigure.redis;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.cache.CacheManagerCustomizers;
import org.springframework.boot.autoconfigure.cache.CacheProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.lang.Nullable;
import org.zodiac.autoconfigure.redis.condition.ConditionalOnRedisEnabled;
import org.zodiac.autoconfigure.security.jwt.SecurityJwtRedisAutoConfiguration;
import org.zodiac.commons.util.Colls;
import java.util.List;
import java.util.Map;
/**
* 扩展redis-cache支持注解cacheName添加超时时间。
*
*/
@SpringBootConfiguration
@ConditionalOnRedisEnabled
@EnableConfigurationProperties(value = {CacheProperties.class})
@AutoConfigureBefore(value = {SecurityJwtRedisAutoConfiguration.class})
@ConditionalOnClass(value = {org.zodiac.redis.cache.RedisAutoCacheManager.class})
public class RedisCacheManagerAutoConfiguration {
/*序列化方式*/
private final RedisSerializer