fastjson反序列化无法添加LinkedCaseInsensitiveMap类为白名单?

我在RedisConfig配置了fastjson的白名单

其中设置了org.springframework.util为白名单,但fastjson依然无法反序列化其中的org.springframework.util.LinkedCaseInsensitiveMap类。

白名单配置如下:

// 配置后 自己写的包的类是成功加入了白名单 能够成功反序列化
ParserConfig.getGlobalInstance().addAccept("com.test.modules.rest.domain");
// 但spingframework源码中的包配置白名单后无效
ParserConfig.getGlobalInstance().addAccept("org.springframework.util");

使用报错:

LinkedCaseInsensitiveMap linkedCaseInsensitiveMap = new LinkedCaseInsensitiveMap();
linkedCaseInsensitiveMap.put("k", "v");
redisTemplate.opsForValue().set("testMap", linkedCaseInsensitiveMap);

// 解析报错 autoType is not support. org.springframework.util.LinkedCaseInsensitiveMap
Object testMap = redisTemplate.opsForValue().get("testMap");
System.out.println(testMap);
阅读 1.4k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题