Refactoring in MethodValidationAdapter

Extract the default logic for resolving the name of an @Valid
parameter into an ObjectNameResolver, and use it when there isn't
one configured.

See gh-30644
This commit is contained in:
rstoyanchev
2023-07-03 07:46:49 +01:00
parent 7a79da589a
commit 84e863f803
3 changed files with 111 additions and 91 deletions

View File

@@ -101,7 +101,7 @@ public class MethodValidationAdapterTests {
MyService target = new MyService();
Method method = getMethod(target, "addStudent");
this.validationAdapter.setBindingResultNameResolver((parameter, value) -> "studentToAdd");
this.validationAdapter.setObjectNameResolver((param, value) -> "studentToAdd");
testArgs(target, method, new Object[] {faustino1234, new Person("Joe"), 1}, ex -> {