原因:key 没有进行序列化,需要加入redis的配置进行序列化
/** * @Author johnson * @Date 2023/6/2 */ @Configuration public class RedisConfig { @Bean public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { RedisTemplate<String, Object> redisTemplate = new RedisTemplate(); redisTemplate.setConnectionFactory(redisConnectionFactory); FastJsonRedisSerializer<Object> fastJsonRedisSerializer = new FastJsonRedisSerializer(Object.class); ParserConfig.getGlobalInstance().setAutoTypeSupport(true); redisTemplate.setValueSerializer(fastJsonRedisSerializer); redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); redisTemplate.setKeySerializer(new StringRedisSerializer()); redisTemplate.setHashKeySerializer(new StringRedisSerializer()); redisTemplate.afterPropertiesSet(); return redisTemplate; } }
标签:xed,x05t,fastJsonRedisSerializer,redisTemplate,key,new,x00,RedisTemplate From: https://www.cnblogs.com/wangzun/p/17451025.html