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
Support for java.util.Optional as a @RequestPart [SPR-12644] #17245
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.
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.
Activity
spring-projects-issues commentedon 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 registeredHttpMessageConverters 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