|
|
|
@ -2,9 +2,6 @@ package com.ruoyi.common.redis.configure;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
|
|
import com.fasterxml.jackson.databind.JavaType;
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
|
|
|
|
import org.springframework.data.redis.serializer.RedisSerializer;
|
|
|
|
|
import org.springframework.data.redis.serializer.SerializationException;
|
|
|
|
|
import com.alibaba.fastjson.parser.ParserConfig;
|
|
|
|
@ -18,8 +15,6 @@ import java.nio.charset.Charset;
|
|
|
|
|
*/
|
|
|
|
|
public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
|
|
|
|
|
{
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
|
|
|
|
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
|
|
|
|
|
|
|
|
@ -58,14 +53,4 @@ public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T>
|
|
|
|
|
return JSON.parseObject(str, clazz);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setObjectMapper(ObjectMapper objectMapper)
|
|
|
|
|
{
|
|
|
|
|
Assert.notNull(objectMapper, "'objectMapper' must not be null");
|
|
|
|
|
this.objectMapper = objectMapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected JavaType getJavaType(Class<?> clazz)
|
|
|
|
|
{
|
|
|
|
|
return TypeFactory.defaultInstance().constructType(clazz);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|