Preserve json type info during serialization when value is wrapped with java.util.Optional #24498

Comment From: rstoyanchev

Thanks for the PR but this is a GenericHttpMessageConverter and typically invoked through the 4-arg write method that also takes a Type. So I don't think this is a good place to solve it and we'd have to put similar logic in all converters.

I think it is better to address this more generally for all supported return types so I'll close this.