-
Notifications
You must be signed in to change notification settings - Fork 38k
-
Notifications
You must be signed in to change notification settings - Fork 38k
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
Http message conversion not finding Jackson JDK8 module in context [SPR-13049] #17641
Comments
Juergen Hoeller commented We're only registering Jackson's general JDK 8 module by default as of Spring 4.2, so I suppose we're talking about a manually registered module here... with multiple ObjectMappers in use at runtime, and only one of them having the manual module registration applied? Juergen |
John Franco commented The code registers the module as a bean in the application context, which the documentation describes as a way to make the module available globally. I think the worse problem is that the object mapper in use by the MVC stack for deserializing requests is not picking up such globally-registered modules. Why doesn't the MVC stack just use the global object mapper bean? That seems the simplest way to let REST controllers customize their JSON handling. |
Sébastien Deleuze commented
Could you check what kind of web configuration your application is using? |
John Franco commented Hello, thank you for responding. I've read the article and added a Jackson2ObjectMapperBuilder bean to the application context following the example at https://github.com/sdeleuze/spring-jackson-demo/blob/master/src/main/java/demo/Application.java. The deserialization still fails. I'll attach an updated git bundle. Would you prefer that I submit my code in another form? The code is using annotation-driven configuration. The main class is ReproServerConfiguration.java in the git bundle. |
Sébastien Deleuze commented I will have a look, thanks. |
Sébastien Deleuze commented I had a look to your sample project, you are using |
John Franco opened SPR-13049 and commented
Despite having a Jackson JDK 8 module bean available in the context, deserializing a request having an Optional<String> field fails with an error indicating that the object mapper in use does not have the module installed. The attached git bundle has a maven project and a unit test to reproduce the problem. The unit test demonstrates that the object mapper available from the context does have the module installed (by deserializing a JSON string into an object having an Optional<String> field), which seems to indicate that the http message handling is using a different object mapper that doesn't have the module installed.
Affects: 4.1.6
Attachments:
Issue Links:
The text was updated successfully, but these errors were encountered: