Closed
Description
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:
- Support for java.util.Optional as a @RequestParam [SPR-11829] #16448 Support for java.util.Optional as a
@RequestParam
- Second call to MVC handler method with Optional parameter fails with argument type mismatch [SPR-13755] #18328 Second call to MVC handler method with Optional parameter fails with argument type mismatch
- RequestPartMethodArgumentResolver should defensively handle MethodParameter nesting level and java.util.Optional access [SPR-13850] #18423 RequestPartMethodArgumentResolver should defensively handle MethodParameter nesting level and java.util.Optional access
- MultipartFile argument requires multipart request even when optional (and empty) [SPR-13849] #18422 MultipartFile argument requires multipart request even when optional (and empty)
- Support for java.util.Optional as a @RequestBody [SPR-15007] #19574 Support for java.util.Optional as a
@RequestBody