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

@@ -181,14 +181,14 @@ public class MethodValidationAdapterTests {
Object target, Method method, Object[] arguments, Consumer<MethodValidationResult> assertions) {
assertions.accept(
this.validationAdapter.validateMethodArguments(target, method, arguments, new Class<?>[0]));
this.validationAdapter.validateMethodArguments(target, method, null, arguments, new Class<?>[0]));
}
private void validateReturnValue(
Object target, Method method, @Nullable Object returnValue, Consumer<MethodValidationResult> assertions) {
assertions.accept(
this.validationAdapter.validateMethodReturnValue(target, method, returnValue, new Class<?>[0]));
this.validationAdapter.validateMethodReturnValue(target, method, null, returnValue, new Class<?>[0]));
}
private static void assertBeanResult(