Skip to content

Add support for java.util.Optional to GenericHttpMessageConverter #24498 #26393

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

Closed

Conversation

encircled
Copy link
Contributor

@encircled encircled commented Jan 16, 2021

Fixes #24498

Added unboxing of java.util.Optional to AbstractHttpMessageConverter and AbstractGenericHttpMessageConverter. If the object is not unboxed, the underlying message converter receives an instance of java.util.Optional, which was causing an issue described in the #24498 in case of Jackson converter. It will also allow to use Optional<*> in other message converters without explicitly registering a type converter.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 16, 2021
@encircled encircled changed the title Add unboxing of java.util.Optional to GenericHttpMessageConverter #24498 Add support for java.util.Optional to GenericHttpMessageConverter #24498 Jan 16, 2021
@sbrannen sbrannen added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Jan 17, 2021
@encircled encircled force-pushed the 24498-fix-optional-unboxing branch from 462300c to 72984e5 Compare January 30, 2021 09:57
@encircled
Copy link
Contributor Author

@sbrannen just a kind reminder. Lets review&merge or close it if you think that such behaviour should not be part of the product

@poutsma poutsma self-assigned this Dec 7, 2021
@daniel-shuy
Copy link

Any update for this PR?

@sbrannen sbrannen added this to the Triage Queue milestone Jun 17, 2022
@encircled encircled force-pushed the 24498-fix-optional-unboxing branch from 72984e5 to 3ab30a2 Compare June 20, 2022 21:02
@rstoyanchev rstoyanchev removed this from the Triage Queue milestone Jan 20, 2023
@poutsma
Copy link
Contributor

poutsma commented Jan 24, 2023

Thank for for submitting a PR, and our apologies for taking this long to resolve it.

We have decided to resolve the underlying issue differently than suggested in this PR, in the Jackson converters rather than the generic converters. See 5502e61 for more details.

@sbrannen
Copy link
Member

@sbrannen sbrannen added status: superseded An issue that has been superseded by another and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 24, 2023
@encircled encircled deleted the 24498-fix-optional-unboxing branch October 14, 2024 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Optional in Jackson 2 message converters
7 participants