diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java index 5791c029514..641f6c7f265 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java @@ -35,13 +35,15 @@ import org.springframework.util.ClassUtils; /** * {@link BeanFactoryPostProcessor} implementation that allows for convenient * registration of custom {@link PropertyEditor property editors}. - * - *
As of Spring 2.0, the recommended usage is to use custom - * {@link PropertyEditorRegistrar} implementations that in turn register - * any desired editors on a given - * {@link org.springframework.beans.PropertyEditorRegistry registry}. - * Each PropertyEditorRegistrar can register any number of custom editors. - * + * + *
+ * In case you want to register {@link PropertyEditor} instances, the + * recommended usage as of Spring 2.0 is to use custom + * {@link PropertyEditorRegistrar} implementations that in turn register any + * desired editor instances on a given + * {@link org.springframework.beans.PropertyEditorRegistry registry}. Each + * PropertyEditorRegistrar can register any number of custom editors. + * *
* <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer"> * <property name="propertyEditorRegistrars"> @@ -50,10 +52,14 @@ import org.springframework.util.ClassUtils; * <bean class="mypackage.MyObjectEditorRegistrar"/> * </list> * </property> - * </bean>- * - *
Alternative configuration example with custom editor classes: - * + * </bean> + * + * + *
+ * It's perfectly fine to register {@link PropertyEditor} classes via + * the {@code 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"> @@ -62,9 +68,19 @@ import org.springframework.util.ClassUtils; * <entry key="mypackage.MyObject" value="mypackage.MyObjectEditor"/> * </map> * </property> - * </bean>- * - *
Also supports "java.lang.String[]"-style array class names and primitive + * </bean> + * + * + *
+ * Note, that you shouldn't register {@link PropertyEditor} bean instances via + * the {@code customEditors} property as {@link PropertyEditor}s 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 + * {@link PropertyEditor}s, use a {@link PropertyEditorRegistrar} to register + * them. + * + *
+ * Also supports "java.lang.String[]"-style array class names and primitive * class names (e.g. "boolean"). Delegates to {@link ClassUtils} for actual * class name resolution. *