Commit c7a15bcc by hulei

提JacksonRedisTemplate至SDK

parent d0eb3663
......@@ -17,11 +17,10 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
**/
public class RedisTemplateBuilder {
public static RedisTemplate<String, Object> craeteJacksonRedisTemplate(RedisConnectionFactory factory){
public static RedisTemplate<String, Object> craeteJacksonRedisTemplate(RedisConnectionFactory factory,ObjectMapper objectMapper){
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
......@@ -41,4 +40,8 @@ public class RedisTemplateBuilder {
return template;
}
public static RedisTemplate<String, Object> craeteJacksonRedisTemplate(RedisConnectionFactory factory) {
return craeteJacksonRedisTemplate(factory,new ObjectMapper());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment