mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Merge branch '7.0.x'
This commit is contained in:
@@ -9,7 +9,7 @@ It is a core mechanism of the Spring Framework that helps with application confi
|
||||
In web applications it makes it easy to access query parameters and form data through richly typed objects rather than through maps of string values.
|
||||
|
||||
To learn more about the data binding mechanism, including constructor and setter binding, property name syntax, type conversion,
|
||||
and more, see the xref:core/validation/data-binding.adoc[Data binding] in the Core Technologies section.
|
||||
and more, see xref:core/validation/data-binding.adoc[Data binding] in the Core Technologies section.
|
||||
|
||||
For annotated controllers, data binding applies to a
|
||||
xref:web/webflux/controller/ann-methods/modelattrib-method-args.adoc[@ModelAttribute] method argument.
|
||||
|
||||
@@ -9,7 +9,7 @@ It is a core mechanism of the Spring Framework that helps with application confi
|
||||
In web applications it makes it easy to access query parameters and form data through richly typed objects rather than through maps of string values.
|
||||
|
||||
To learn more about the data binding mechanism, including constructor and setter binding, property name syntax, type conversion,
|
||||
and more, see the xref:core/validation/data-binding.adoc[Data binding] in the Core Technologies section.
|
||||
and more, see xref:core/validation/data-binding.adoc[Data binding] in the Core Technologies section.
|
||||
|
||||
For annotated controllers, data binding applies to a
|
||||
xref:web/webmvc/mvc-controller/ann-methods/modelattrib-method-args.adoc[@ModelAttribute] method argument.
|
||||
|
||||
@@ -30,14 +30,14 @@ For example:
|
||||
|
||||
NOTE: It is also possible to configure `disallowedFields`, but that's fragile, and
|
||||
due to be https://github.com/spring-projects/spring-framework/issues/36802[deprecated] in Spring Framework 7.1.
|
||||
It is easy to miss or add others over time that should also be excluded.
|
||||
It is easy to overlook fields or introduce additional fields over time that should also be excluded.
|
||||
|
||||
By default, `DataBinder` applies both constructor and setter binding.
|
||||
This is fine with immutable objects and dedicated objects, but for domain objects, you must
|
||||
remember to set `allowedFields`. To ensure data binding is only used in declarative style where
|
||||
expected inputs are explicitly declared, you can set `declarativeBinding` on `DataBinder`.
|
||||
That applies constructor binding always, and setter binding conditionally if `allowedFields` is set.
|
||||
The below shows how to set this flag globally, or
|
||||
The following shows how to set this flag globally, or
|
||||
you can also narrow it through attributes on `ControllerAdvice`:
|
||||
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
|
||||
Reference in New Issue
Block a user