You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MappingJacksonHttpMessageConverter's ObjectMapper does not use ConversionService when binding JSON to JavaBean properties [SPR-6731] #11397
has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: enhancementA general enhancement
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.
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.
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.
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 Jackson2ObjectMapperFactoryBean#mixIns and Jackson2ObjectMapperBuilder#mixIns().
I plan to close this issue shortly unless someone think I should not.
has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issuetype: enhancementA general enhancement
Activity
spring-projects-issues commentedon Jan 22, 2010
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
spring-projects-issues commentedon Mar 14, 2010
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.
spring-projects-issues commentedon Jul 8, 2011
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.
spring-projects-issues commentedon Dec 29, 2011
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?
spring-projects-issues commentedon Jan 3, 2012
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.
spring-projects-issues commentedon Aug 29, 2012
Andriy Godovanets commented
So, if somebody wants to make mvc-ajax work for 3.1 spring version, he should:
spring-projects-issues commentedon Mar 10, 2014
Burkhard Graves commented
Any news concerning this task? Tips, examples, workarounds, other libs, ...? Appreciate any hints!
spring-projects-issues commentedon Nov 4, 2014
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
Jackson2ObjectMapperFactoryBean#mixInsandJackson2ObjectMapperBuilder#mixIns().I plan to close this issue shortly unless someone think I should not.
spring-projects-issues commentedon Nov 13, 2014
Sébastien Deleuze commented
This issue it is duplicated by #11715