Object o = redisTemplate.opsForValue().get(key);对o进行强转的时候会报JSONObject无法转换成自定义类型对RedisTemplate<String,Object>的定义不友好而Jackson的GenericJackson2JsonRedisSerializer可以直接拿来强转
Object o = redisTemplate.opsForValue().get(key);
fae0ux8s1#
Adding a FastJsonRedisSerializer is way to fix it.
iih3973s2#
FastJsonRedisSerializer is for specific type, but I want to add a redisTemplate as a default template in the project which should handle any type as object. FastJsonRedisSerializer cannot do that
2条答案
按热度按时间fae0ux8s1#
Adding a FastJsonRedisSerializer is way to fix it.
iih3973s2#
FastJsonRedisSerializer is for specific type, but I want to add a redisTemplate as a default template in the project which should handle any type as object. FastJsonRedisSerializer cannot do that