Class BindingContext
java.lang.Object
org.springframework.web.reactive.BindingContext
Context to assist with binding request data onto Objects and provide access
to a shared 
Model with controller-specific attributes.
Provides  methods to create a WebExchangeDataBinder for a specific
target, command Object to apply data binding and validation to, or without a
target Object for simple type conversion from request values.
Container for the default model for the request.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller
- 
Constructor SummaryConstructorsConstructorDescriptionCreate an instance without an initializer.BindingContext(@Nullable WebBindingInitializer initializer) Create an instance with the given initializer, which may benull.BindingContext(@Nullable WebBindingInitializer initializer, ReactiveAdapterRegistry registry) Create an instance with the given initializer andReactiveAdapterRegistry.
- 
Method SummaryModifier and TypeMethodDescriptionprotected WebExchangeDataBindercreateBinderInstance(@Nullable Object target, String name) Extension point to create the WebDataBinder instance.createDataBinder(ServerWebExchange exchange, @Nullable Object target, String name) Create a binder with a target object.createDataBinder(ServerWebExchange exchange, @Nullable Object target, String name, @Nullable ResolvableType targetType) Create a binder with a target object and atargetType.createDataBinder(ServerWebExchange exchange, String name) Shortcut method to create a binder without a target object.getModel()Return the default model.protected WebExchangeDataBinderinitDataBinder(WebExchangeDataBinder binder, ServerWebExchange exchange) Initialize the data binder instance for the given exchange.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.voidupdateModel(ServerWebExchange exchange) Invoked before rendering to addBindingResultattributes where necessary, and also to promote model attributes listed as@SessionAttributesto the session.
- 
Constructor Details- 
BindingContextpublic BindingContext()Create an instance without an initializer.
- 
BindingContextCreate an instance with the given initializer, which may benull.
- 
BindingContextpublic BindingContext(@Nullable WebBindingInitializer initializer, ReactiveAdapterRegistry registry) Create an instance with the given initializer andReactiveAdapterRegistry.- Since:
- 6.1
 
 
- 
- 
Method Details- 
getModelReturn the default model.
- 
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
 
- 
createDataBinderpublic WebExchangeDataBinder createDataBinder(ServerWebExchange exchange, @Nullable Object target, String name) Create a binder with a target object.- Parameters:
- exchange- the current exchange
- target- the object to create a data binder for
- name- the name of the target object
- Returns:
- the created data binder
- Throws:
- ServerErrorException- if- @InitBindermethod invocation fails
 
- 
createDataBinderShortcut method to create a binder without a target object.- Parameters:
- exchange- the current exchange
- name- the name of the target object
- Returns:
- the created data binder
- Throws:
- ServerErrorException- if- @InitBindermethod invocation fails
 
- 
createDataBinderpublic WebExchangeDataBinder createDataBinder(ServerWebExchange exchange, @Nullable Object target, String name, @Nullable ResolvableType targetType) Create a binder with a target object and atargetType. If the target isnull, thentargetTypeis set.- Since:
- 6.1
 
- 
createBinderInstanceExtension point to create the WebDataBinder instance. By default, this isWebRequestDataBinder.- Parameters:
- target- the binding target or- nullfor type conversion only
- name- the binding target object name
- Returns:
- the created WebExchangeDataBinderinstance
- Since:
- 6.2.1
 
- 
initDataBinderprotected WebExchangeDataBinder initDataBinder(WebExchangeDataBinder binder, ServerWebExchange exchange) Initialize the data binder instance for the given exchange.- Throws:
- ServerErrorException- if- @InitBindermethod invocation fails
 
- 
updateModelInvoked before rendering to addBindingResultattributes where necessary, and also to promote model attributes listed as@SessionAttributesto the session.- Parameters:
- exchange- the current exchange
- Since:
- 6.1
 
 
-