-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support Jackson2 based XML serialization/deserialization [SPR-11785] #16407
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
Comments
Juergen Hoeller commented Could we also do this as a flag on MappingJackson2HttpMessageConverter itself, or even let it happen automatically there if jackson-dataformat-xml is on the classpath? Juergen |
Sébastien Deleuze commented We could, and it was in fact my first intention. But MappingJackson2HttpMessageConverter package is org.springframework.http.converter.json, and I was not confortable with the idea to put XML related functionalities in it. That's why I ended up with the following proposal:
If we could move MappingJackson2HttpMessageConverter to org.springframework.http.converter package, staying with a single class would be perfect, but I don't know if we can do a such breaking change. Do you think we could, or is it fine for you to put XML related code in org.springframework.http.converter.json.MappingJackson2HttpMessageConverter ? |
Juergen Hoeller commented Fair enough, that's a good point. However, given the options, I'd rather put the support into MappingJackson2HttpMessageConverter itself, interpreting the subpackage name as "primarily json oriented providers" (or as an abbreviation for j-ack-son) ;-) Seriously, I don't think it's worth a convoluted split here, in particular given that Jackson2ObjectMapperFactoryBean lives in the json subpackage as well and is probably equally useful for the jackson-dataformat-xml case. Juergen |
Sébastien Deleuze commented Thanks for your feedback ! Thinking more about that, Jackson itself use a lot of JSON historically related stuff (including configuration options) for XML serialization, so yes it is better to add support in existing MappingJackson2HttpMessageConverter. It may allow us to add other formats supported by Jackson more easily later if we want to. I have updated the issue title accordingly. |
Sébastien Deleuze opened SPR-11785 and commented
It is basically a MappingJackson2HttpMessageConverter where we register a JacksonXmlModule. It could allow users to setup easily a XML + JSON webservice supporting filtering thanks to JsonView.
It is also a nice alternative to Jaxb2 since it allows to get XML support without
@XmlRootElement
annotations.It would not impact existing Jaxb2 support since it can be activated only if JacksonXmlModule class from jackson-dataformat-xml JAR module is detected on the classpath.
Issue Links:
@JsonView
Referenced from: commits ebc726a, 6665634
The text was updated successfully, but these errors were encountered: