<mvc:annotation-driven /> doesn't allow CustomPropertyEditor be co-exists [SPR-7077] #11737
Comments
Chris Beams commented Rossen, please see the linked forum issue as well as this new one recently submitted: http://forum.springsource.org/showthread.php?112734-Best-way-to-configer-StringTrimmerEditor-globally-using-Spring-3.1-with-Java-Config&p=373716 |
Rossen Stoyanchev commented We can consider supporting a propertyEditorRegistrar attribute on <annotation-driven />. A workaround which you might be aware of is using a BeanPostProcessor (code sample) or Java config in Spring 3.1 (code sample). |
Canny Duck commented The link to the BeanPostProcessor code sample is broken. Can you please fix it? I want to register StringTrimmerEditor without Java config using the XML-style. |
Rossen Stoyanchev commented I've corrected the link to the sample above. See the JacksonConversionServiceConfigurer class but keep in mind you might have to check for a bean of instance RequestMappingHandlerAdapter rather than AnnotationMethodHandlerAdapter depending on which one you're actually using. |
Canny Duck commented Thanks for your quick reply. I would be glad if you can show me a little code example setting the StringTrimmerEditor as PropertyEditor on the RequestMappingHandlerAdapter. |
Canny Duck commented This code unfortunately does not work. Any ideas? public class DefaultBindingConfigurer implements BeanPostProcessor
} |
Rossen Stoyanchev commented The forum would be a more appropriate place for this type of discussion. Please, post a question there and provide some detail around "doesn't work". |
Rossen Stoyanchev commented
|
Simon Wong opened SPR-7077 and commented
Although it is preferable to use conversionService rather than use the CustomEditor, in some situation, custom editor is still required (e.g. StringTrimmerEditor). The current AnnotationDrivenBeanDefinitionParser (used by MvcNamespaceHandler for <mvc:annotation-driven />) will create a ConfigurableWebBindingInitializer instance internally, which doesn't allow to register custom editors with propertyEditorRegistrars.
Affects: 3.0 GA, 3.0.1, 3.0.2
Reference URL: http://forum.springsource.org/showthread.php?t=84267
Issue Links:
7 votes, 12 watchers
The text was updated successfully, but these errors were encountered: