Spring Boot自定义Redis缓存配置,保存value格式JSON字符串
2020-12-13 01:46
标签:tail factory data bin color unknown detail default 序列 Spring Boot自定义Redis缓存,保存格式JSON字符串 部分内容转自 https://blog.csdn.net/caojidasabi/article/details/83059642 Spring Boot自定义Redis缓存配置,保存value格式JSON字符串 标签:tail factory data bin color unknown detail default 序列 原文地址:https://www.cnblogs.com/taopanfeng/p/11009088.htmlpackage springboot01cache.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import springboot01cache.bean.Student;
import java.net.UnknownHostException;
import java.time.Duration;
@Configuration
public class MyRedisConfig
{
//自定义RedisTemplate
@Bean
public RedisTemplate
文章标题:Spring Boot自定义Redis缓存配置,保存value格式JSON字符串
文章链接:http://soscw.com/essay/24181.html