Hans Desmet opened SPR-15745 and commented
The tag
Affects: 4.3.9
Reference URL: https://github.com/desmethans/errorstag.git
Comment From: spring-projects-issues
Juergen Hoeller commented
Any idea where the randomness comes from? BindStatus
and co store errors in registration order... Are you possibly using Bean Validation, with reflection ordering coming into play here?
Comment From: spring-projects-issues
Hans Desmet commented
I'm indeed using Bean Validation.
Comment From: snicoll
Unfortunately, I don't think there is much we can do. When using Bean Validation, we delegate to jakarta.validation.Validator#validate
that returns a Set
. There's nothing in the Javadoc of the method that mentions ordering and that returns a HashSet
. SpringValidatorAdapter
loops over them and add each to the BindingResult
instance. That layer has no knowledge about the form or even the structure of the object. Given you have the knowledge of the form, that ordering is best done on your end, IMO.