As described under #26219, in https://github.com/spring-projects/spring-framework/issues/26219#issuecomment-739385184 and https://github.com/spring-projects/spring-framework/issues/26219#issuecomment-1195260724, when handling method validation errors, it's useful to know what it relates to, e.g. header name, cookie value, etc.
After #29825 and #30644 it is already possible to get a MethodParameter
from each ParameterValidationResult
and check parameter annotations. We can make it even easier to handle validation results for controller methods by method parameter type.
Comment From: rstoyanchev
HandlerMethodValidationException
now has a visitResults
method that takes a Visitor to handle validation results by controller method parameter type.