Add MethodParameter[] input to MethodValidationAdapter

This allows re-use of existing MethodParameter instances from controller
methods with cached metadata, and also ensures additional capabilities
such as looking up parameter annotations on interfaces.

See gh-29825
This commit is contained in:
rstoyanchev
2023-06-13 17:40:32 +01:00
parent e7c3e1c516
commit 85d81024a4
8 changed files with 94 additions and 57 deletions

View File

@@ -152,7 +152,8 @@ public class InvocableHandlerMethod extends HandlerMethod {
return getMethodArgumentValues(exchange, bindingContext, providedArgs).flatMap(args -> {
Class<?>[] groups = getValidationGroups();
if (shouldValidateArguments() && this.methodValidator != null) {
this.methodValidator.validateArguments(getBean(), getBridgedMethod(), args, groups);
this.methodValidator.validateArguments(
getBean(), getBridgedMethod(), getMethodParameters(), args, groups);
}
Object value;
Method method = getBridgedMethod();