Align validation groups check with InvocableHandlerMethod in spring-web

Closes gh-36337
This commit is contained in:
Juergen Hoeller
2026-02-17 12:15:07 +01:00
parent 474d520182
commit 2c7ed5e5f1
@@ -149,7 +149,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
/**
* Configure a reactive adapter registry. This is needed for cases where the response is
* fully handled within the controller in combination with an async void return value.
* <p>By default this is a {@link ReactiveAdapterRegistry} with default settings.
* <p>By default, this is a {@link ReactiveAdapterRegistry} with default settings.
*/
public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry) {
this.reactiveAdapterRegistry = registry;
@@ -163,7 +163,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);
}