Merge branch '7.0.x'

This commit is contained in:
rstoyanchev
2026-09-02 10:00:49 +01:00
15 changed files with 46 additions and 26 deletions
@@ -107,4 +107,6 @@ Kotlin::
[[webflux-ann-initbinder-model-design]]
NOTE: For more guidance on model design, please see xref:web/webflux/data-binding.adoc[Data Binding].
== Model Design
Please see xref:web/webflux/data-binding.adoc[Data Binding] for more guidance on model object design.
@@ -49,7 +49,7 @@ recommended either to use an object tailored specifically for web binding, or to
constructor binding only. If property binding must still be used, then _allowedFields_
patterns should be set to limit which properties can be set. For further details on this
and example configuration, see
xref:web/webflux/controller/ann-initbinder.adoc#webflux-ann-initbinder-model-design[model design].
xref:web/webflux/data-binding.adoc#webflux-data-binding-design[model design].
When using constructor binding, you can customize request parameter names through an
`@BindParam` annotation. For example:
@@ -107,4 +107,6 @@ Kotlin::
[[mvc-ann-initbinder-model-design]]
NOTE: For more guidance on model design, please see xref:web/webmvc/mvc-data-binding.adoc[Data Binding].
== Model Design
Please see xref:web/webmvc/mvc-data-binding.adoc[Data Binding] for guidance on safe model object design.
@@ -84,7 +84,7 @@ recommended either to use an object tailored specifically for web binding, or to
constructor binding only. If property binding must still be used, then _allowedFields_
patterns should be set to limit which properties can be set. For further details on this
and example configuration, see
xref:web/webmvc/mvc-controller/ann-initbinder.adoc#mvc-ann-initbinder-model-design[model design].
xref:web/webmvc/mvc-data-binding.adoc#mvc-data-binding-design[model design].
When using constructor binding, you can customize request parameter names through an
`@BindParam` annotation. For example:
@@ -78,8 +78,8 @@ import org.springframework.validation.annotation.ValidationAnnotationUtils;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* <p>The binding results can be examined via the {@link BindingResult} interface,
@@ -48,8 +48,8 @@ import org.springframework.web.util.WebUtils;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* <p>See the DataBinder/WebDataBinder superclasses for customization options,
@@ -41,8 +41,8 @@ import org.springframework.web.multipart.MultipartFile;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* <p>Includes support for field markers which address a common problem with
@@ -35,8 +35,8 @@ import org.springframework.aot.hint.annotation.Reflective;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* <p>{@code @InitBinder} methods support all arguments that
@@ -37,8 +37,8 @@ import org.springframework.ui.Model;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* <p>{@code @ModelAttribute} can be used to expose command objects to a web view,
@@ -42,8 +42,8 @@ import org.springframework.web.server.ServerWebExchange;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* @author Rossen Stoyanchev
@@ -45,8 +45,8 @@ import org.springframework.web.multipart.support.StandardServletPartUtils;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* <p>See the DataBinder/WebDataBinder superclasses for customization options,
@@ -190,6 +190,10 @@ public interface ServerRequest {
/**
* Bind to this request and return an instance of the given type.
* <p>Please read the security warning om
* {@link org.springframework.validation.DataBinder} and review the guidance
* on model object design in the Data Binding section for Spring WebFlux in
* the reference documentation.
* @param bindType the type of class to bind this request to
* @param <T> the type to bind to
* @return a mono containing either a constructed and bound instance of
@@ -202,9 +206,13 @@ public interface ServerRequest {
/**
* Bind to this request and return an instance of the given type.
* <p>Please read the security warning om
* {@link org.springframework.validation.DataBinder} and review the guidance
* on model object design in the Data Binding section for Spring WebFlux in
* the reference documentation.
* @param bindType the type of class to bind this request to
* @param dataBinderCustomizer used to customize the data binder, for example, set
* (dis)allowed fields
* @param dataBinderCustomizer used to customize the data binder, for example,
* set allowed fields if using property (instead of constructor) binding.
* @param <T> the type to bind to
* @return a mono containing either a constructed and bound instance of
* {@code bindType}, or a {@link BindException} in case of binding errors
@@ -142,6 +142,10 @@ public interface ServerRequest {
/**
* Bind to this request and return an instance of the given type.
* <p>Please read the security warning om
* {@link org.springframework.validation.DataBinder} and review the guidance
* on model object design in the Data Binding section for Spring MVC in
* the reference documentation.
* @param bindType the type of class to bind this request to
* @param <T> the type to bind to
* @return a constructed and bound instance of {@code bindType}
@@ -154,9 +158,13 @@ public interface ServerRequest {
/**
* Bind to this request and return an instance of the given type.
* <p>Please read the security warning om
* {@link org.springframework.validation.DataBinder} and review the guidance
* on model object design in the Data Binding section for Spring MVC in
* the reference documentation.
* @param bindType the type of class to bind this request to
* @param dataBinderCustomizer used to customize the data binder, for example, set
* (dis)allowed fields
* @param dataBinderCustomizer used to customize the data binder, for example,
* set allowed fields if using property (instead of constructor) binding.
* @param <T> the type to bind to
* @return a constructed and bound instance of {@code bindType}
* @throws BindException in case of binding errors
@@ -30,8 +30,8 @@ import org.springframework.web.servlet.HandlerMapping;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* @author Rossen Stoyanchev
@@ -43,8 +43,8 @@ import org.springframework.web.servlet.HandlerMapping;
* 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
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-initbinder-model-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-ann-initbinder-model-design">Spring WebFlux</a>
* <a href="https://docs.spring.io/spring-framework/reference/web/webmvc/mvc-data-binding.html#mvc-data-binding-design">Spring Web MVC</a> and
* <a href="https://docs.spring.io/spring-framework/reference/web/webflux/data-binding.html#webflux-data-binding-design">Spring WebFlux</a>
* in the reference manual.
*
* @author Rossen Stoyanchev