Why can I not register a PropertyEditor for String in Spring MVC?
- by Tom Tucker
I'm using Spring 3.0.3. I've enabled the default ConversionService by adding this line to my Spring configuration XML.
<mvc:annotation-driven/>
I'm also using custom PropertyEditor's for certain data types, so I've registered them for corresponding data types like the following and they work fine.
webDataBinder.registerCustomEditor(Date.class, new MyPropertyEditor());
I have a custom tag library that extends Spring's Form tag library, and I can acess these PropertyEditor's through getPropertyEditor() of AbstractDataBoundFormElementTag.
What I don't understand is that I can't register a custom PropertyEditor for String for some reason. The following wouldn't work.
webDataBinder.registerCustomEditor(String.class, new MyPropertyEditor());
When I do getPropertyEditor(), it always returns a ConvertingPropertyEditorAdapter, instead of MyPropertyEditor.
Is this a bug?
EDIT: I realized that I didn't do some stuff right. Spring works just fine.