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

Request params Optional<List<String> and List<String> are inconsistent [SPR-15676] #20235

spring-issuemaster opened this issue Jun 16, 2017 · 2 comments


None yet
2 participants
Copy link

commented Jun 16, 2017

Ayush Kumar opened SPR-15676 and commented

When using List<String> as the request parameter, both key=val1,val2 and key=val1&key=val2 end up mapping to key = [val1, val2]

When using Optional<List<String>> as the request parameter
key=val1,val2 maps to key = Optional([val1,val2])
but key=val1&key=val2 maps to Optional([val1])

This makes RequestParam(..., required = false) List<String> behave differently from RequestParam(...) Optional<List<String>>, which seems unfortunate.

Affects: 4.3.4

Issue Links:

  • #20412 @RequestParam Optional<List<?>> not handling multiple params of the same name correctly ("is duplicated by")
  • #17997 Request parameters cannot bind to Optional<List>
  • #20472 java.util.Optional MultipartFile[] @RequestParam argument is null in multipart/form-data POST
  • #20473 only one MultipartFile object populated when using an java.util.Optional MutipartFile array or list @RequestParam

Backported to: 4.3.12

1 votes, 3 watchers


This comment has been minimized.

Copy link
Collaborator Author

commented Jun 16, 2017

Ayush Kumar commented

Linked to #17997


This comment has been minimized.

Copy link
Collaborator Author

commented Sep 20, 2017

Juergen Hoeller commented

This turns out to be addressed by the fix for #20473. I've added dedicated tests for regular parameter values as well now.

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.