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
Support for annotating multiple arguments with @RequestBody #24894
Comments
I think the problem is in The converter passes A temporary fix for you could be disabling the global This can be fixed in Spring by adding |
@juzerali , Agreed that marking |
When you say "multiple beans", do you perhaps mean multiple beans of different types? I ask, because your example shows two beans of the exact same type ( |
@sbrannen , yes I mean multiple beans of different types. |
You are right, it was a lame attempt. What do you think could be a solution? |
So presumably the input is a JSON object that contains the data for both CustomBean1 and CustomBean2, in which case you could create one top-level object that contains both. Using a caching request wrapper could be another way to go, but that is not something we are going to do out of the box. |
I am using
spring-webmvc
5.2.3.I want to use Spring's Default MethodArgumentResolver to resolve the json payload into multiple beans. But I am not able to do that right now because
AbstractMessageConverterMethodArgumentResolver.EmptyBodyCheckingHttpInputMessage(httpRequest)
is passed the HttpRequest object and is used directly. While attempting to resolve the second argument the HttpRequest's inputStream is closed, so I get an exception saying that the input stream is closed. Ergo I am able to annotate only one argument with@RequestBody
.Why not use a
ContentCachingRequestWrapper
instead of the actual HttpRequest for argument resolution ?The text was updated successfully, but these errors were encountered: