Skip to content
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 java.util.Optional as a @RequestPart [SPR-12644] #17245

Closed
spring-issuemaster opened this issue Jan 19, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jan 19, 2015

Anderson Vaz opened SPR-12644 and commented

In issue #16448 was introduced support for java.util.Optional for @ResquestParam Controllers method parameters however it was not spread to @RequestPart parameters.
Attached is a project Spring Boot demonstrating the issue. When the parameter is @RequestPart and Optional, Spring can't convert the value.

I think that would be nice to have this feature implemented for @RequestPart parameters too.

Thanks!


Affects: 4.1.3, 4.1.4

Reference URL: https://github.com/avaz/spring-bug-optional-requestpart.git

Issue Links:

  • #16448 Support for java.util.Optional as a @RequestParam
  • #18328 Second call to MVC handler method with Optional parameter fails with argument type mismatch
  • #18423 RequestPartMethodArgumentResolver should defensively handle MethodParameter nesting level and java.util.Optional access
  • #18422 MultipartFile argument requires multipart request even when optional (and empty)
  • #19574 Support for java.util.Optional as a @RequestBody
@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 12, 2015

Juergen Hoeller commented

This turns out to be rather involved due to all the parameter type variants of @RequestPart, including the need to delegate to the registered HttpMessageConverters with a nested parameter type (which the infrastructure wasn't prepared for yet). So I'll keep it as a 4.2 feature, to be available in the next 4.2 snapshot tomorrow, going through the 4.2 RC phase.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.