提交 fffd9cab 编写于 作者: 如梦技术's avatar 如梦技术 🐛

🐛 mica-redis jackson class info.

上级 39ec068a
......@@ -17,6 +17,11 @@
[**更新记录**](CHANGELOG.md)
## 版本号说明
`release` 版本号格式为 `x.x.x.发版当然日期`
`snapshots` 版本号格式为 `x.x.x-SNAPSHOT``snapshots` 版每次提交后会自动构建。
## 已知问题
lombok 生成的 method 问题:https://github.com/rzwitserloot/lombok/issues/1861
......
VERSION=2.0.1.200509-SNAPSHOT
VERSION=2.0.1-SNAPSHOT
GROUPID=net.dreamlu
NEXUS_OSS_USER_NAME=***
......
......@@ -16,7 +16,9 @@
package net.dreamlu.mica.redis.config;
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import net.dreamlu.mica.redis.cache.MicaRedisCache;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
......@@ -60,7 +62,11 @@ public class RedisTemplateConfiguration {
}
// jackson findAndRegisterModules,use copy
ObjectMapper objectMapper = objectProvider.getIfAvailable(ObjectMapper::new).copy();
// findAndRegisterModules
objectMapper.findAndRegisterModules();
// class type info to json
GenericJackson2JsonRedisSerializer.registerNullValueSerializer(objectMapper, null);
objectMapper.activateDefaultTyping(objectMapper.getPolymorphicTypeValidator(), DefaultTyping.NON_FINAL, As.PROPERTY);
return new GenericJackson2JsonRedisSerializer(objectMapper);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册