RedisUtil调整

This commit is contained in:
TanJ 2023-08-17 19:58:10 +08:00
parent 94fd3c5817
commit 32e8fdcd08

View File

@ -1,10 +1,12 @@
package cn.axzo.pokonyan.config.redis;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.data.redis.RedisSystemException;
@ -53,13 +55,12 @@ public class RedisUtil implements InitializingBean {
@Override
public Object deserialize(byte[] bytes) throws SerializationException {
try {
return super.deserialize(bytes);
return new StringRedisSerializer().deserialize(bytes);
} catch (Exception e) {
log.warn("object序列化出错可能不是object类型使用string序列化,exception:{}",e.getMessage());
return new StringRedisSerializer().deserialize(bytes);
return super.deserialize(bytes);
}
}
});