GenericFastJsonRedisSerializer对RedisTemplate的支持不易用

w51jfk4q  于 6个月前  发布在  Redis
关注(0)|答案(2)|浏览(124)

Object o = redisTemplate.opsForValue().get(key);
对o进行强转的时候会报JSONObject无法转换成自定义类型
对RedisTemplate<String,Object>的定义不友好
而Jackson的GenericJackson2JsonRedisSerializer可以直接拿来强转

fae0ux8s

fae0ux8s1#

Adding a FastJsonRedisSerializer is way to fix it.

iih3973s

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

相关问题