You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of Spring 4.0.1 the same call returns false which is due to that change (introduced for #15884). From the commit however, it's not quite clear why the implementation of ObjectToObjectConverter now explicitly excludes String.valueOf(…).
While that change did come as part of #15884 where a general "toX()" convention was baked into ObjectToObjectConverter, it is intentional in that we never meant to return true for the generic Object-to-String case. Instead, our FallbackObjectToStringConverter always had specific rules when it would say true here, such as a specifically declared constructor or valueOf method that can perform specific String conversion here. However, due to the generic "String.valueOf(Object)" method, that convention unfortunately made it return true for the super-generic Object-to-String case... and that basically got corrected as part of #15884.
In fact, if a caller wants to accept any toString() result, he shouldn't call the ConversionService in the first place but rather simply call toString() himself.
Oliver Drotbohm opened SPR-11693 and commented
On Spring 3.2.8 a default
ConversionService
instance (e.g.DefaultFormattingConversionService
will answer the following call withtrue
:As of Spring 4.0.1 the same call returns
false
which is due to that change (introduced for #15884). From the commit however, it's not quite clear why the implementation ofObjectToObjectConverter
now explicitly excludesString.valueOf(…)
.Affects: 4.0.1, 4.0.2, 4.0.3
Issue Links:
The text was updated successfully, but these errors were encountered: