mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Use HandlerMethod-determined validation groups
Closes gh-36336
This commit is contained in:
+1
-6
@@ -55,7 +55,6 @@ import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.lang.Contract;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.ValidationAnnotationUtils;
|
||||
import org.springframework.validation.method.MethodValidator;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.reactive.BindingContext;
|
||||
@@ -97,8 +96,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
|
||||
private @Nullable MethodValidator methodValidator;
|
||||
|
||||
private Class<?>[] validationGroups = EMPTY_GROUPS;
|
||||
|
||||
private @Nullable Scheduler invocationScheduler;
|
||||
|
||||
|
||||
@@ -165,8 +162,6 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
*/
|
||||
public void setMethodValidator(@Nullable MethodValidator methodValidator) {
|
||||
this.methodValidator = methodValidator;
|
||||
this.validationGroups = (methodValidator != null ?
|
||||
ValidationAnnotationUtils.determineValidationGroups(getBean(), getBridgedMethod()) : EMPTY_GROUPS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +188,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
try {
|
||||
LocaleContextHolder.setLocaleContext(exchange.getLocaleContext());
|
||||
this.methodValidator.applyArgumentValidation(
|
||||
getBean(), getBridgedMethod(), getMethodParameters(), args, this.validationGroups);
|
||||
getBean(), getBridgedMethod(), getMethodParameters(), args, getValidationGroups());
|
||||
}
|
||||
finally {
|
||||
LocaleContextHolder.resetLocaleContext();
|
||||
|
||||
Reference in New Issue
Block a user