public class ConfigurableWebBindingInitializer extends Object implements WebBindingInitializer
WebBindingInitializer
for declarative configuration
in a Spring application context. Allows for reusing pre-configured
initializers with multiple controller/handlers.setDirectFieldAccess(boolean)
,
setMessageCodesResolver(org.springframework.validation.MessageCodesResolver)
,
setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor)
,
setValidator(Validator)
,
setConversionService(ConversionService)
,
setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar)
Constructor and Description |
---|
ConfigurableWebBindingInitializer() |
Modifier and Type | Method and Description |
---|---|
org.springframework.validation.BindingErrorProcessor |
getBindingErrorProcessor()
Return the strategy to use for processing binding errors.
|
org.springframework.core.convert.ConversionService |
getConversionService()
Return the ConversionService which will apply to every DataBinder.
|
org.springframework.validation.MessageCodesResolver |
getMessageCodesResolver()
Return the strategy to use for resolving errors into message codes.
|
org.springframework.beans.PropertyEditorRegistrar[] |
getPropertyEditorRegistrars()
Return the PropertyEditorRegistrars to be applied to every DataBinder.
|
org.springframework.validation.Validator |
getValidator()
Return the Validator to apply after each binding step, if any.
|
void |
initBinder(WebDataBinder binder,
WebRequest request)
Initialize the given DataBinder for the given request.
|
boolean |
isAutoGrowNestedPaths()
Return whether a binder should attempt to "auto-grow" a nested path that contains a null value.
|
boolean |
isDirectFieldAccess()
Return whether to use direct field access instead of bean property access.
|
void |
setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
Set whether a binder should attempt to "auto-grow" a nested path that contains a null value.
|
void |
setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor bindingErrorProcessor)
Set the strategy to use for processing binding errors, that is,
required field errors and
PropertyAccessException s. |
void |
setConversionService(org.springframework.core.convert.ConversionService conversionService)
Specify a ConversionService which will apply to every DataBinder.
|
void |
setDirectFieldAccess(boolean directFieldAccess)
Set whether to use direct field access instead of bean property access.
|
void |
setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)
Set the strategy to use for resolving errors into message codes.
|
void |
setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar propertyEditorRegistrar)
Specify a single PropertyEditorRegistrar to be applied to every DataBinder.
|
void |
setPropertyEditorRegistrars(org.springframework.beans.PropertyEditorRegistrar[] propertyEditorRegistrars)
Specify multiple PropertyEditorRegistrars to be applied to every DataBinder.
|
void |
setValidator(org.springframework.validation.Validator validator)
Set the Validator to apply after each binding step.
|
public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
If "true", a null path location will be populated with a default object value and traversed instead of resulting in an exception. This flag also enables auto-growth of collection elements when accessing an out-of-bounds index.
Default is "true" on a standard DataBinder. Note that this feature is only supported for bean property access (DataBinder's default mode), not for field access.
DataBinder.initBeanPropertyAccess()
,
DataBinder.setAutoGrowNestedPaths(boolean)
public boolean isAutoGrowNestedPaths()
public final void setDirectFieldAccess(boolean directFieldAccess)
Default is false
, using bean property access.
Switch this to true
in order to enforce direct field access.
DataBinder.initDirectFieldAccess()
,
DataBinder.initBeanPropertyAccess()
public boolean isDirectFieldAccess()
public final void setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)
Default is null
, i.e. using the default strategy of
the data binder.
DataBinder.setMessageCodesResolver(org.springframework.validation.MessageCodesResolver)
public final org.springframework.validation.MessageCodesResolver getMessageCodesResolver()
public final void setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor bindingErrorProcessor)
PropertyAccessException
s.
Default is null
, that is, using the default strategy
of the data binder.
DataBinder.setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor)
public final org.springframework.validation.BindingErrorProcessor getBindingErrorProcessor()
public final void setValidator(org.springframework.validation.Validator validator)
public final org.springframework.validation.Validator getValidator()
public final void setConversionService(org.springframework.core.convert.ConversionService conversionService)
public final org.springframework.core.convert.ConversionService getConversionService()
public final void setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar propertyEditorRegistrar)
public final void setPropertyEditorRegistrars(org.springframework.beans.PropertyEditorRegistrar[] propertyEditorRegistrars)
public final org.springframework.beans.PropertyEditorRegistrar[] getPropertyEditorRegistrars()
public void initBinder(WebDataBinder binder, WebRequest request)
WebBindingInitializer
initBinder
in interface WebBindingInitializer
binder
- the DataBinder to initializerequest
- the web request that the data binding happens within