litemall
litemall copied to clipboard
JacksonUtil 封装的太。。。了 不需要每次都 new ObjectMapper();
建议整个JacksonUtil 使用一个ObjectMapper ObjectMapper本身线程安全 每次都要new 一个 增加GC 负担
public final static ObjectMapper mapper; static { mapper = new ObjectMapper(); mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } 可以初始化为全局变量
觉得技术不好的地方,欢迎pr。 项目以业务为主,技术很简单,一些实践的地方也的确很粗糙。