fix(JsonUtil): 修复 Redis 中 Object 序列化与反序列化不一致导致报错的问题

pull/739/head
xiaoQQya 2023-02-04 18:13:47 +08:00
parent d50dd3fe84
commit a5ed284658
1 changed files with 2 additions and 3 deletions

View File

@ -27,11 +27,10 @@ public final class JsonUtil {
* @return result type
*/
public static <T> T redisJsonToObject(String key, Class<T> clazz) {
JSONObject jsonObject = (JSONObject) RedisUtil.get(key);
Object jsonObject = RedisUtil.get(key);
if (Objects.isNull(jsonObject)) {
return null;
}
return JSON.parseObject(jsonObject.toJSONString(), clazz);
return clazz.cast(jsonObject);
}
}