Top Description Methods
org.springframework.web.bind.annotation

public @Interface InitBinder

extends Annotation
Annotations
@Target:METHOD
@Retention:RUNTIME
@Documented
@Reflective
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target, org.springframework.aot.hint.annotation.Reflective

Annotation that identifies methods that initialize the org.springframework.web.bind.WebDataBinder which will be used for populating command and form object arguments of annotated handler methods.

Warning

Data binding can lead to security issues by exposing parts of the object graph that are not meant to be accessed or modified by external clients. Therefore the design and use of data binding should be considered carefully with regard to security. For more details, please refer to the dedicated sections on data binding for Spring Web MVC and Spring WebFlux in the reference manual.

@InitBinder methods support all arguments that @RequestMapping methods support, except for command/form objects and corresponding validation result objects. @InitBinder methods must not have a return value; they are usually declared as void.

Typical arguments are org.springframework.web.bind.WebDataBinder in combination with org.springframework.web.context.request.WebRequest or java.util.Locale, allowing to register context-specific editors.

Authors
Juergen Hoeller, Sebastien Deleuze
Since
2.5
See Also
ControllerAdvice, org.springframework.web.bind.WebDataBinder, org.springframework.web.context.request.WebRequest

Method Summary

Modifier and TypeMethod and Description
public String[]
value()

The names of command/form attributes and/or request parameters that this init-binder method is supposed to apply to.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String[] value()

The names of command/form attributes and/or request parameters that this init-binder method is supposed to apply to.

Default is to apply to all command/form attributes and all request parameters processed by the annotated handler class. Specifying model attribute names or request parameter names here restricts the init-binder method to those specific attributes/parameters, with different init-binder methods typically applying to different groups of attributes or parameters.