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
MappingJacksonHttpMessageConverter's ObjectMapper does not use ConversionService when binding JSON to JavaBean properties [SPR-6731] #11397
Comments
Keith Donald commented We have successfully plugged ConversionService into Jackson against Spring 3.0 here: https://src.springframework.org/svn/spring-samples/mvc-ajax/trunk |
recoco zhang commented Hi, keith Donald, I have integrated Jackson to Spring 3.0 using your way. But I think it's not a Spring standard method. As I understand, it should be done by servlet config xml file. And it aroused another problem, I can't configure another conversionService such as dozer mapper together. |
Sebastien Tardif commented What is the workflow in the example? https://src.springframework.org/svn/spring-samples/mvc-ajax/trunk I don't see any mention of your custom mapping classes in the spring configuration xml file. |
Jet Ma commented Hi Keith, the sample's way to plug ConversionService into Jackson can't work in Spring 3.1.0 RELEASE. I realize since Spring 3.1.0 org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser does not allow us to inject a custom HttpMessageConverter(https://jira.springsource.org/browse/SPR-7091), and how can I do with the 3.1 version? |
Rossen Stoyanchev commented Jet, it is actually easier to provide a custom HttpMessageConverter in Spring 3.1. It's built into the MVC namespace as opposed to the mvc-ajax example which had to use a BeanPostProcessor to update the MappingJacksonHttpMessageConverter, see #11751. |
Andriy Godovanets commented So, if somebody wants to make mvc-ajax work for 3.1 spring version, he should:
|
Burkhard Graves commented Any news concerning this task? Tips, examples, workarounds, other libs, ...? Appreciate any hints! |
Sébastien Deleuze commented I think this need is now covered by the new support for Jackson MixIn Annotations available in the upcoming 4.1.2 release as part of #16758 and #16918. Please notice that it is now really easy to register them thanks to I plan to close this issue shortly unless someone think I should not. |
Sébastien Deleuze commented This issue it is duplicated by #11715 |
Keith Donald opened SPR-6731 and commented
Noticed when using
@RequestBody
to bind an incoming JSON string to an Account JavaBean. I was expecting the binding process to respect format annotations such as@NumberFormat
and@DateTimeFormat
during string-to-propertyType conversion. However, this did not happen since it appears the MappingJacksonHttpMessageConverter is using the default Jackson ObjectMapper by default. For consistency, we should consider configuring Jackson to work with the ConversionService during its mapping process. This would allow format annotations like@NumberFormat
and@DateTimeFormat
to be respected.Affects: 3.0 GA
Issue Links:
13 votes, 20 watchers
The text was updated successfully, but these errors were encountered: