This PR addresses #19935/#21461.
~~I'm not sure about the implementation. I wrote the tests that I think would be needed. Three of them are failing:~~
~~org.springframework.beans.BeanWrapperGenericsTests#testGenericOptionalOfListsWithElementConversion~~ ~~org.springframework.beans.BeanWrapperGenericsTests#testGenericOptionalOfMaps~~ ~~org.springframework.beans.BeanWrapperGenericsTests#testGenericOptionalOfMapsWithElementConversion~~
~~Some help here is appreciated.~~
Thanks!
Comment From: baso53
Updated the pull-request with the fix for previously failing tests added with the submitted changes.
Comment From: sbrannen
If this PR (or a variant thereof) is accepted and addresses all issues raised in #19935, #19935 should then be closed as well.
Comment From: snicoll
Thanks for the PR but we don't want to support Optional
for types like map, list and certainly not arrays. We'll continue the discussion on the related issue to see what we can recommend.