Class HandlerMethodValidator
java.lang.Object
org.springframework.validation.beanvalidation.DefaultMethodValidator
org.springframework.web.method.annotation.HandlerMethodValidator
- All Implemented Interfaces:
MethodValidator
MethodValidator
for
use with @RequestMapping
methods. Helps to determine object names
and populates BindingResult
method arguments with errors from
beanResults
.- Since:
- 6.1
- Author:
- Rossen Stoyanchev
-
Method Summary
Modifier and TypeMethodDescriptionstatic MethodValidator
from
(WebBindingInitializer bindingInitializer, ParameterNameDiscoverer parameterNameDiscoverer) Static factory method to create aHandlerMethodValidator
if Bean Validation is enabled in Spring MVC or WebFlux.protected void
handleArgumentsValidationResult
(Object bean, Method method, Object[] arguments, Class<?>[] groups, MethodValidationResult result) Subclasses can override this to handle the result of argument validation.Methods inherited from class org.springframework.validation.beanvalidation.DefaultMethodValidator
determineValidationGroups, handleReturnValueValidationResult, validateArguments, validateReturnValue
-
Method Details
-
handleArgumentsValidationResult
protected void handleArgumentsValidationResult(Object bean, Method method, Object[] arguments, Class<?>[] groups, MethodValidationResult result) Description copied from class:DefaultMethodValidator
Subclasses can override this to handle the result of argument validation. By default,MethodValidationResult.throwIfViolationsPresent()
is called.- Overrides:
handleArgumentsValidationResult
in classDefaultMethodValidator
- Parameters:
bean
- the target Object for method invocationmethod
- the target methodarguments
- the candidate argument values to validategroups
- groups for validation determined via
-
from
@Nullable public static MethodValidator from(@Nullable WebBindingInitializer bindingInitializer, @Nullable ParameterNameDiscoverer parameterNameDiscoverer) Static factory method to create aHandlerMethodValidator
if Bean Validation is enabled in Spring MVC or WebFlux.
-