Class DefaultDataBinderFactory
java.lang.Object
org.springframework.web.bind.support.DefaultDataBinderFactory
- All Implemented Interfaces:
- WebDataBinderFactory
- Direct Known Subclasses:
- InitBinderDataBinderFactory
Create a 
WebRequestDataBinder instance and initialize it with a
 WebBindingInitializer.- Since:
- 3.1
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructorsConstructorDescriptionDefaultDataBinderFactory(WebBindingInitializer initializer) Create a newDefaultDataBinderFactoryinstance.
- 
Method SummaryModifier and TypeMethodDescriptionfinal WebDataBindercreateBinder(NativeWebRequest webRequest, Object target, String objectName) Create a newWebDataBinderfor the given target object and initialize it through aWebBindingInitializer.final WebDataBindercreateBinder(NativeWebRequest webRequest, Object target, String objectName, ResolvableType type) Variant ofWebDataBinderFactory.createBinder(NativeWebRequest, Object, String)with aResolvableTypefor which theDataBinderis created.protected WebDataBindercreateBinderInstance(Object target, String objectName, NativeWebRequest webRequest) Extension point to create the WebDataBinder instance.protected voidinitBinder(WebDataBinder dataBinder, NativeWebRequest webRequest) Extension point to further initialize the created data binder instance (e.g.voidsetMethodValidationApplicable(boolean methodValidationApplicable) Configure flag to signal whether validation will be applied to handler method arguments, which is the case if Bean Validation is enabled in Spring MVC, and method parameters have@Constraintannotations.
- 
Constructor Details- 
DefaultDataBinderFactoryCreate a newDefaultDataBinderFactoryinstance.- Parameters:
- initializer- for global data binder initialization (or- nullif none)
 
 
- 
- 
Method Details- 
setMethodValidationApplicablepublic void setMethodValidationApplicable(boolean methodValidationApplicable) Configure flag to signal whether validation will be applied to handler method arguments, which is the case if Bean Validation is enabled in Spring MVC, and method parameters have@Constraintannotations.- Since:
- 6.1
 
- 
createBinderpublic final WebDataBinder createBinder(NativeWebRequest webRequest, @Nullable Object target, String objectName) throws Exception Create a newWebDataBinderfor the given target object and initialize it through aWebBindingInitializer.- Specified by:
- createBinderin interface- WebDataBinderFactory
- Parameters:
- webRequest- the current request
- target- the object to create a data binder for, or- nullif creating a binder for a simple type
- objectName- the name of the target object
- Returns:
- the created WebDataBinderinstance, never null
- Throws:
- Exception- in case of invalid state or arguments
 
- 
createBinderpublic final WebDataBinder createBinder(NativeWebRequest webRequest, @Nullable Object target, String objectName, ResolvableType type) throws Exception Variant ofWebDataBinderFactory.createBinder(NativeWebRequest, Object, String)with aResolvableTypefor which theDataBinderis created. This may be used to construct the target, or otherwise provide more insight on how to initialize the binder.By default, if the parameter has @Valid, Bean Validation is excluded, deferring to method validation.- Specified by:
- createBinderin interface- WebDataBinderFactory
- Throws:
- Exception
 
- 
createBinderInstanceprotected WebDataBinder createBinderInstance(@Nullable Object target, String objectName, NativeWebRequest webRequest) throws Exception Extension point to create the WebDataBinder instance. By default, this isWebRequestDataBinder.- Parameters:
- target- the binding target or- nullfor type conversion only
- objectName- the binding target object name
- webRequest- the current request
- Throws:
- Exception- in case of invalid state or arguments
 
- 
initBinderExtension point to further initialize the created data binder instance (e.g. with@InitBindermethods) after "global" initialization viaWebBindingInitializer.- Parameters:
- dataBinder- the data binder instance to customize
- webRequest- the current request
- Throws:
- Exception- if initialization fails
 
 
-