Skip to content

Support for java.util.Optional as a @RequestPart [SPR-12644] #17245

Closed

Description

@spring-projects-issues

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:

Activity

  1. spring-projects-issues commented on Feb 12, 2015

    @spring-projects-issues
    CollaboratorAuthor

    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

  2. added
    type: enhancement
    in: web
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions