open class CustomEditorConfigurer : BeanFactoryPostProcessor, Ordered
BeanFactoryPostProcessor implementation that allows for convenient registration of custom PropertyEditor.
In case you want to register PropertyEditor instances, the recommended usage as of Spring 2.0 is to use custom PropertyEditorRegistrar implementations that in turn register any desired editor instances on a given org.springframework.beans.PropertyEditorRegistry. Each PropertyEditorRegistrar can register any number of custom editors.
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="propertyEditorRegistrars"> <list> <bean class="mypackage.MyCustomDateEditorRegistrar"/> <bean class="mypackage.MyObjectEditorRegistrar"/> </list> </property> </bean>
It's perfectly fine to register PropertyEditor classes via the customEditors property. Spring will create fresh instances of them for each editing attempt then:
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="customEditors"> <map> <entry key="java.util.Date" value="mypackage.MyCustomDateEditor"/> <entry key="mypackage.MyObject" value="mypackage.MyObjectEditor"/> </map> </property> </bean>
Note, that you shouldn't register PropertyEditor bean instances via the customEditors property as PropertyEditors are stateful and the instances will then have to be synchronized for every editing attempt. In case you need control over the instantiation process of PropertyEditors, use a PropertyEditorRegistrar to register them.
Also supports "java.lang.String[]"-style array class names and primitive class names (e.g. "boolean"). Delegates to ClassUtils for actual class name resolution.
NOTE: Custom property editors registered with this configurer do not apply to data binding. Custom editors for data binding need to be registered on the org.springframework.validation.DataBinder: Use a common base class or delegate to common PropertyEditorRegistrar implementations to reuse editor registration there.
Author
Juergen Hoeller
Since
27.02.2004
See Also
java.beans.PropertyEditororg.springframework.beans.PropertyEditorRegistrarConfigurableBeanFactory#addPropertyEditorRegistrarConfigurableBeanFactory#registerCustomEditororg.springframework.validation.DataBinder#registerCustomEditor
CustomEditorConfigurer()
BeanFactoryPostProcessor implementation that allows for convenient registration of custom PropertyEditor. In case you want to register PropertyEditor instances, the recommended usage as of Spring 2.0 is to use custom PropertyEditorRegistrar implementations that in turn register any desired editor instances on a given org.springframework.beans.PropertyEditorRegistry. Each PropertyEditorRegistrar can register any number of custom editors.
It's perfectly fine to register PropertyEditor classes via the
Note, that you shouldn't register PropertyEditor bean instances via the Also supports "java.lang.String[]"-style array class names and primitive class names (e.g. "boolean"). Delegates to ClassUtils for actual class name resolution. NOTE: Custom property editors registered with this configurer do not apply to data binding. Custom editors for data binding need to be registered on the org.springframework.validation.DataBinder: Use a common base class or delegate to common PropertyEditorRegistrar implementations to reuse editor registration there. |
open fun getOrder(): Int |
|
open fun postProcessBeanFactory(beanFactory: ConfigurableListableBeanFactory): Unit |
|
open fun setCustomEditors(customEditors: MutableMap<Class<*>, Class<out PropertyEditor>>): Unit
Specify the custom editors to register via a Map, using the class name of the required type as the key and the class name of the associated PropertyEditor as value. |
|
open fun setOrder(order: Int): Unit |
|
open fun setPropertyEditorRegistrars(propertyEditorRegistrars: Array<PropertyEditorRegistrar>): Unit
Specify the PropertyEditorRegistrar to apply to beans defined within the current application context. This allows for sharing |