From 5843db5996873a371fbe53283faa38d8e55bdf59 Mon Sep 17 00:00:00 2001 From: Hee Chan Date: Fri, 11 Jul 2025 19:46:15 +0900 Subject: [PATCH] Update ann-validation.adoc Added a section explaining that container parameters annotated with `@Valid` Signed-off-by: Hee Chan --- .../pages/web/webmvc/mvc-controller/ann-validation.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-validation.adoc b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-validation.adoc index 99ddf8635eb1..83fb47be5ca8 100644 --- a/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-validation.adoc +++ b/framework-docs/modules/ROOT/pages/web/webmvc/mvc-controller/ann-validation.adoc @@ -20,6 +20,13 @@ directly on method parameters, or on the method (for the return value), then met validation must be applied, and that supersedes validation at the method argument level because method validation covers both method parameter constraints and nested constraints via `@Valid`. The exception raised in this case is `HandlerMethodValidationException`. ++ +Container parameters annotated with `@Valid`—for example, +`@RequestBody List items` or `@RequestBody @Valid List<@Valid Foo> items`—are +likewise subject to method validation. They are detected by +`HandlerMethod.MethodValidationInitializer.checkArguments(…)`, and any +resulting constraint violations cause a `HandlerMethodValidationException` +to be raised. Applications must handle both `MethodArgumentNotValidException` and `HandlerMethodValidationException` as either may be raised depending on the controller