spring boot redis配置类

配置redisTemplate 模板 和 注册redis缓存管理器

@EnableCaching
@Configuration
public class customRedisConfig extends  CachingConfigurerSupport {
   
    @Bean
    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
   
        RedisTemplate<String, Object> template = new RedisTemplate<>();
        RedisSerializer<String> redisSerializer = new StringRedisSerializer();
        Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
        ObjectMapper 

你可能感兴趣的:(spring boot redis配置类)