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

Set Jackson DEFAULT_VIEW_INCLUSION property to false by default [SPR-12179] #16793

Closed
spring-projects-issues opened this issue Sep 11, 2014 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 11, 2014

Sébastien Deleuze opened SPR-12179 and commented

As stated in Jackson JsonView documentation documentation, by default all properties without explicit view definition are included in serialization.

Spring Framework 4.1 GA currently uses this default behavior, but this could be misleading since most users expect to have only the properties annotated with the JsonView specified on the handler method included in the serialized output.

It should be a better default to set SerializationConfig.Feature.DEFAULT_VIEW_INCLUSION to false. It will be still possible to change this behavior with Jackson2ObjectMapperFactoryBean#setDefaultViewInclusion().


Affects: 4.1 GA

Reference URL: http://wiki.fasterxml.com/JacksonJsonViews

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Sep 17, 2014

Rossen Stoyanchev commented

This sounded alright at first but looking at the details, I am reminded once again of #16510 where we decided to fix it in Boot. I see this as being in the exact same category.

I do think Jackson2ObjectMapperFactoryBean is the one place where we can a provide proper default, i.e. one that doesn't change as soon as you change some unrelated property. It makes me think also that providing some such mechanism in Java config would be useful, i.e. an ObjectMapper initializer that gives you specific defaults. That could be used in the MVC config by default and would provide a path for providing a custom ObjectMapper on top of such defaults.

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

Thanks for your feedback, enabling this kind of configuration by default in the MVC config in a customizable way seems to be the right level to me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants