Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JacksonUtil 封装的太。。。了 不需要每次都 new ObjectMapper(); #448

Open
vxinv opened this issue Dec 21, 2020 · 1 comment
Open

Comments

@vxinv
Copy link

vxinv commented Dec 21, 2020

建议整个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);
}
可以初始化为全局变量

@linlinjava
Copy link
Owner

觉得技术不好的地方,欢迎pr。
项目以业务为主,技术很简单,一些实践的地方也的确很粗糙。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants