Unable to define empty java.util.Optional bean in spring xml [SPR-14121] #18693
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Yibo Wang opened SPR-14121 and commented
A bean who refers to an empty java.util.Optional value cannot be created with Spring configuration xml.
In Spring config xml file I have:
Then when the Spring config was loaded, it reported the following error:
Looks like spring tried to extract the nested value of the Optional class and use that to assign to the bean which was not what I intended. (What I tried to do was to have both empty Optional and present Optional and later conditionally choose to use one of them. So if spring did not extract the nested value, it would just work (like if the Optional is from Guava.))
Thanks
Affects: 4.2.4
Issue Links:
Referenced from: commits 0864834, 5c1d3fc, 157dcab
The text was updated successfully, but these errors were encountered: