From df588e030f069dd31997ff747839f1d8d5d8d7c7 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 15 Jun 2021 17:30:41 +0200 Subject: [PATCH] Avoid duplicated documentation of validation annotations See gh-27042, gh-27043, gh-27050 --- .../AbstractMessageReaderArgumentResolver.java | 8 ++++---- .../annotation/RequestPartMethodArgumentResolver.java | 9 ++++----- .../annotation/RequestResponseBodyMethodProcessor.java | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java index 07a7e70f4861..082bd5e88bc0 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java @@ -58,10 +58,10 @@ * Abstract base class for argument resolvers that resolve method arguments * by reading the request body with an {@link HttpMessageReader}. * - *

Applies validation if the method argument is annotated with - * {@code @javax.validation.Valid} or - * {@link org.springframework.validation.annotation.Validated}. Validation - * failure results in an {@link ServerWebInputException}. + *

Applies validation if the method argument is annotated with any + * {@linkplain org.springframework.validation.annotation.ValidationAnnotationUtils#determineValidationHints + * annotations that trigger validation}. Validation failure results in a + * {@link ServerWebInputException}. * * @author Rossen Stoyanchev * @author Sebastien Deleuze diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java index becddd99e218..e828239d7100 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestPartMethodArgumentResolver.java @@ -58,11 +58,10 @@ * the part is not specified, the request part's name is derived from the name of * the method argument. * - *

Automatic validation may be applied if the argument is annotated with - * {@code @javax.validation.Valid}, Spring's {@link org.springframework.validation.annotation.Validated} - * annotation, or a custom annotation whose name starts with "Valid". In case of - * validation failure, a {@link MethodArgumentNotValidException} is raised and a - * 400 response status code returned if the + *

Automatic validation may be applied if the argument is annotated with any + * {@linkplain org.springframework.validation.annotation.ValidationAnnotationUtils#determineValidationHints + * annotations that trigger validation}. In case of validation failure, a + * {@link MethodArgumentNotValidException} is raised and a 400 response status code returned if the * {@link org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver} * is configured. * diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java index 4e14d8a31155..50e4fd56413b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestResponseBodyMethodProcessor.java @@ -51,8 +51,9 @@ * to the body of the request or response with an {@link HttpMessageConverter}. * *

An {@code @RequestBody} method argument is also validated if it is annotated - * with {@code @javax.validation.Valid}, Spring's {@link org.springframework.validation.annotation.Validated} - * or custom annotations whose name starts with "Valid". In case of validation failure, + * with any + * {@linkplain org.springframework.validation.annotation.ValidationAnnotationUtils#determineValidationHints + * annotations that trigger validation}. In case of validation failure, * {@link MethodArgumentNotValidException} is raised and results in an HTTP 400 * response status code if {@link DefaultHandlerExceptionResolver} is configured. *