Issue in HandlerMethodValidationException.visitResults when class level annotations are used in @RequestBody #34105
Labels
status: waiting-for-triage
An issue we've not yet triaged or decided on
Environment
Spring Boot: 3.3.6
Spring Web: 6.1.15
Java: 21
Context:
A
@RequestMapping
that makes use of@Constraint
annotations to validate@RequestHeader
and uses@Valid
annotation to validate@RequestBody
.Controller
Dto
Please note that the
RequestDto
uses@Constraint
annotations at field level and also class level.CustomAnnotation and Validator
Since I have
@Contraint
annotations declared directly on method parameters, the exception raised isHandlerMethodValidationException
.I'm using the
HandlerMethodValidationException.visitResults
to handle the errors.Issue:
When I use a
@Constraint
annotation at class level, theHandlerMethodValidationException
validationResult list is composed of aParameterValidationResult
instead of aParameterErrors
object.This fails in the visitor assertion that exists in
HandlerMethodValidationException.asErrors
method:Thanks for the support.
The text was updated successfully, but these errors were encountered: