-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Support Optional
in PayloadMethodArgumentResolver
#28945
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
Comments
I think you're suggesting to turn As for |
Hi @rstoyanchev ! Right, I concur with all your arguments. |
I've scheduled it for the |
PayloadMethodArgumentResolver
for better end-user experience
PayloadMethodArgumentResolver
for better end-user experienceOptional
in PayloadMethodArgumentResolver
Sometime the data for payload method argument is optional and we cover that with a
@Payload(required = false)
.It would be nice if this
PayloadMethodArgumentResolver
would treat a@Nullable payload
same way as thatrequired = false
.Another improvement is around an
Optional
: theisEmptyPayload(@Nullable Object payload)
should add a check forOptional.isEmpty()
.Technically we cannot transfer a
null
in messaging at the moment, so theOptional.empty()
is good compromise for us.However this one probably should have an effect only if method param type is not an
Optional
, so no checks no conversions necessary. I assume this is an existing behavior.What we need is just an automatic
Optional
resolution tonull
if@Nullable
or@Payload(required = false)
.Thanks
The text was updated successfully, but these errors were encountered: