Browse Source

Avoid determineValidationGroups not necessary

There is no need to call determineValidationGroups if the method
itself doesn't require method validation.

See gh-36274
pull/36179/head
rstoyanchev 1 month ago
parent
commit
02dc4b6342
  1. 2
      spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java

2
spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java

@ -150,7 +150,7 @@ public class InvocableHandlerMethod extends HandlerMethod { @@ -150,7 +150,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
*/
public void setMethodValidator(@Nullable MethodValidator methodValidator) {
this.methodValidator = methodValidator;
this.validationGroups = (methodValidator != null ?
this.validationGroups = (methodValidator != null && (shouldValidateArguments() || shouldValidateReturnValue()) ?
methodValidator.determineValidationGroups(getBean(), getBridgedMethod()) : EMPTY_GROUPS);
}

Loading…
Cancel
Save