How to use a Formatter on a String with the spring:eval tag?
I ran into a small problem today when I wanted to show a String property using spring:eval tag. The property has a custom converter associated with it using the AnnotationFormatterFactory.
When the property is rendered using a form:input tag everything works as expected and the formatted output is shown.
If the same property is rendered using the spring:eval tag the original, unformatted, value is shown.
This is caused by the convertTypedValue() method in the ExpressionUtils class determining that the expression value is already a String and will not using the TypeConverter. I can imagine that most of the time this is the desired behavior, but when formatting a string it causes a problem.
Maybe the spring:eval tag should get another attribute to indicate that the conversionservice should be used even if the type is already a String?