diff --git a/spring-context/src/main/java/org/springframework/validation/DataBinder.java b/spring-context/src/main/java/org/springframework/validation/DataBinder.java index cbdbc679fb2..3ab1cf202ea 100644 --- a/spring-context/src/main/java/org/springframework/validation/DataBinder.java +++ b/spring-context/src/main/java/org/springframework/validation/DataBinder.java @@ -144,14 +144,14 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { private String[] requiredFields; - private BindingErrorProcessor bindingErrorProcessor = new DefaultBindingErrorProcessor(); - - private final List validators = new ArrayList<>(); - private ConversionService conversionService; private MessageCodesResolver messageCodesResolver; + private BindingErrorProcessor bindingErrorProcessor = new DefaultBindingErrorProcessor(); + + private final List validators = new ArrayList<>(); + /** * Create a new DataBinder instance, with default object name. @@ -252,12 +252,14 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { protected AbstractPropertyBindingResult createBeanPropertyBindingResult() { BeanPropertyBindingResult result = new BeanPropertyBindingResult(getTarget(), getObjectName(), isAutoGrowNestedPaths(), getAutoGrowCollectionLimit()); + if (this.conversionService != null) { result.initConversion(this.conversionService); } if (this.messageCodesResolver != null) { result.setMessageCodesResolver(this.messageCodesResolver); } + return result; } @@ -476,16 +478,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter { return this.requiredFields; } - /** - * Set whether to extract the old field value when applying a - * property editor to a new value for a field. - *

Default is "true", exposing previous field values to custom editors. - * Turn this to "false" to avoid side effects caused by getters. - */ - public void setExtractOldValueForEditor(boolean extractOldValueForEditor) { - getPropertyAccessor().setExtractOldValueForEditor(extractOldValueForEditor); - } - /** * Set the strategy to use for resolving errors into message codes. * Applies the given strategy to the underlying errors holder.