-
-
Notifications
You must be signed in to change notification settings - Fork 127
Support configuring the Jackson Object Mapper #376
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
Conversation
|
Thanks! I will take a look. |
|
In the end, I don't see the the difference. You replaced |
| objectMapper.registerModule(new AfterburnerModule()); | ||
| } | ||
|
|
||
| protected abstract ObjectMapper getObjectMapper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's enough to make this method public.
|
Hi, I hadn't looked at #274 before submitting this. I agree It is not enough to make I think the #274 pattern is probably cleanest, even though a bit more verbose. I propose the following:
What would be different is that when I create my own ObjectMapper, I would just extend |
|
Never mind, I hadn't fully understood the #274 pattern until I tried it. You're right, the changes I submitted weren't needed to customize Jackson easily. I've kept this PR alive as a simple rename from |
|
The rename is good but we have a problem because we brake the API, without a very good reason and I am sure that they are people that use this method ( |
|
Alright, I'll close this then. Thanks for your help. |
|
BTW, if anyone stumbles across this looking for info on how to follow the #274 pattern, it's like this: JacksonJsonEngine customEngine = new JacksonJsonEngine(){
@Override
public void init(Application application) {
super.init(application);
objectMapper.registerModule(new Jdk8Module());
objectMapper.registerModule(new GuavaModule());
}
};
customEngine.init(this);
getContentTypeEngines().setContentTypeEngine(customEngine); |
This change provides a getter for the Jackson Object Mapper so that Pippo applications can customize it as they need. E.g. I have this in my
onInit: