Package org.springframework.web.bind.support

# Class ConfigurableWebBindingInitializer

java.lang.Object
org.springframework.web.bind.support.ConfigurableWebBindingInitializer

All Implemented Interfaces:
  `WebBindingInitializer`

public class ConfigurableWebBindingInitializer extends Object implements WebBindingInitializer
Convenient `WebBindingInitializer` for declarative configuration in a Spring application context. Allows for reusing pre-configured initializers with multiple controller/handlers.

Since:
  2.5
Author:
  Juergen Hoeller
See Also:
  - `setDirectFieldAccess(boolean)`
  - `setMessageCodesResolver(org.springframework.validation.MessageCodesResolver)`
  - `setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor)`
  - `setValidator(Validator)`
  - `setConversionService(ConversionService)`
  - `setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar)`

## Constructor Summary

Constructors
Constructor
Description
`ConfigurableWebBindingInitializer()`

## Method Summary

Modifier and Type
Method
Description
`final org.springframework.validation.BindingErrorProcessor`
`getBindingErrorProcessor()`
Return the strategy to use for processing binding errors.
`final org.springframework.core.convert.ConversionService`
`getConversionService()`
Return the ConversionService which will apply to every DataBinder.
`final org.springframework.validation.MessageCodesResolver`
`getMessageCodesResolver()`
Return the strategy to use for resolving errors into message codes.
`final org.springframework.beans.PropertyEditorRegistrar[]`
`getPropertyEditorRegistrars()`
Return the PropertyEditorRegistrars to be applied to every DataBinder.
`final org.springframework.validation.Validator`
`getValidator()`
Return the Validator to apply after each binding step, if any.
`void`
`initBinder(WebDataBinder binder)`
Initialize the given DataBinder.
`boolean`
`isAutoGrowNestedPaths()`
Return whether a binder should attempt to "auto-grow" a nested path that contains a null value.
`boolean`
`isDeclarativeBinding()`
Return whether to bind only fields intended for binding.
`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.
`final void`
`setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor bindingErrorProcessor)`
Set the strategy to use for processing binding errors, that is, required field errors and `PropertyAccessException`s.
`final void`
`setConversionService(org.springframework.core.convert.ConversionService conversionService)`
Specify a ConversionService which will apply to every DataBinder.
`void`
`setDeclarativeBinding(boolean declarativeBinding)`
Set whether to bind only fields intended for binding as described in `DataBinder.setDeclarativeBinding(boolean)`.
`final void`
`setDirectFieldAccess(boolean directFieldAccess)`
Set whether to use direct field access instead of bean property access.
`final void`
`setMessageCodesResolver(org.springframework.validation.MessageCodesResolver messageCodesResolver)`
Set the strategy to use for resolving errors into message codes.
`final void`
`setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar propertyEditorRegistrar)`
Specify a single PropertyEditorRegistrar to be applied to every DataBinder.
`final void`
`setPropertyEditorRegistrars(org.springframework.beans.PropertyEditorRegistrar[] propertyEditorRegistrars)`
Specify multiple PropertyEditorRegistrars to be applied to every DataBinder.
`final void`
`setValidator(org.springframework.validation.Validator validator)`
Set the Validator to apply after each binding step.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ConfigurableWebBindingInitializer

public ConfigurableWebBindingInitializer()

## Method Details

### setAutoGrowNestedPaths

public void setAutoGrowNestedPaths(boolean autoGrowNestedPaths)
Set whether a binder should attempt to "auto-grow" a nested path that contains a null value.

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.

See Also:
  - `DataBinder.initBeanPropertyAccess()`
  - `DataBinder.setAutoGrowNestedPaths(boolean)`

### isAutoGrowNestedPaths

public boolean isAutoGrowNestedPaths()
Return whether a binder should attempt to "auto-grow" a nested path that contains a null value.

### setDirectFieldAccess

public final void setDirectFieldAccess(boolean directFieldAccess)
Set whether to use direct field access instead of bean property access.

Default is `false`, using bean property access. Switch this to `true` in order to enforce direct field access.

See Also:
  - `DataBinder.initDirectFieldAccess()`
  - `DataBinder.initBeanPropertyAccess()`

### isDirectFieldAccess

public boolean isDirectFieldAccess()
Return whether to use direct field access instead of bean property access.

### setDeclarativeBinding

public void setDeclarativeBinding(boolean declarativeBinding)
Set whether to bind only fields intended for binding as described in `DataBinder.setDeclarativeBinding(boolean)`.

Since:
  6.1

### isDeclarativeBinding

public boolean isDeclarativeBinding()
Return whether to bind only fields intended for binding.

Since:
  6.1

### setMessageCodesResolver

public final void setMessageCodesResolver(@Nullable org.springframework.validation.MessageCodesResolver messageCodesResolver)
Set the strategy to use for resolving errors into message codes. Applies the given strategy to all data binders used by this controller.

Default is `null`, i.e. using the default strategy of the data binder.

See Also:
  - `DataBinder.setMessageCodesResolver(org.springframework.validation.MessageCodesResolver)`

### getMessageCodesResolver

@Nullable public final org.springframework.validation.MessageCodesResolver getMessageCodesResolver()
Return the strategy to use for resolving errors into message codes.

### setBindingErrorProcessor

public final void setBindingErrorProcessor(@Nullable org.springframework.validation.BindingErrorProcessor bindingErrorProcessor)
Set the strategy to use for processing binding errors, that is, required field errors and `PropertyAccessException`s.

Default is `null`, that is, using the default strategy of the data binder.

See Also:
  - `DataBinder.setBindingErrorProcessor(org.springframework.validation.BindingErrorProcessor)`

### getBindingErrorProcessor

@Nullable public final org.springframework.validation.BindingErrorProcessor getBindingErrorProcessor()
Return the strategy to use for processing binding errors.

### setValidator

public final void setValidator(@Nullable org.springframework.validation.Validator validator)
Set the Validator to apply after each binding step.

### getValidator

@Nullable public final org.springframework.validation.Validator getValidator()
Return the Validator to apply after each binding step, if any.

### setConversionService

public final void setConversionService(@Nullable org.springframework.core.convert.ConversionService conversionService)
Specify a ConversionService which will apply to every DataBinder.

Since:
  3.0

### getConversionService

@Nullable public final org.springframework.core.convert.ConversionService getConversionService()
Return the ConversionService which will apply to every DataBinder.

### setPropertyEditorRegistrar

public final void setPropertyEditorRegistrar(org.springframework.beans.PropertyEditorRegistrar propertyEditorRegistrar)
Specify a single PropertyEditorRegistrar to be applied to every DataBinder.

### setPropertyEditorRegistrars

public final void setPropertyEditorRegistrars(@Nullable org.springframework.beans.PropertyEditorRegistrar[] propertyEditorRegistrars)
Specify multiple PropertyEditorRegistrars to be applied to every DataBinder.

### getPropertyEditorRegistrars

@Nullable public final org.springframework.beans.PropertyEditorRegistrar[] getPropertyEditorRegistrars()
Return the PropertyEditorRegistrars to be applied to every DataBinder.

### initBinder

public void initBinder(WebDataBinder binder)
Description copied from interface: `WebBindingInitializer`
Initialize the given DataBinder.

Specified by:
  `initBinder` in interface `WebBindingInitializer`
Parameters:
  `binder` - the DataBinder to initialize