Ankur Pathak opened SPR-17339 and commented

This method of SpringValidatorAdaptor should be public or their should be some similar public interface:

protected void processConstraintViolations(Set> violations, Errors errors) {}

It allows to convert Set\ to BindingResult(BindException). So it has pottential of being used outside spring framework may be jax-rs, jax-ws in following manner: 1. We can validate the bean using bean validation api. 2. Convert Set\ to BindingResult using above method 3. Use that binding result to report good validation messages in any rest or soap java web api frmeaork.

Making that method protected is conflicting with above use case. Or we can have similar pblic interface to convert Ser\ to BindingResult.

Even some api framework like jax-ws jesey  have integration for bean validation api and through constraintvoilationexception. this exception has set\. Right now we don;t have any interface in LocalValidatorFactory to convert it to bindingresult. The advantage bindingresult

has is by using it we can easily prepare validation errors for user in any framework.


Affects: 5.0.9, 5.1 GA

Comment From: spring-projects-issues

Ankur Pathak commented

Here is a repository where I am trying to do so for Jersey(Jersey On Spring Boot):

https://github.com/ankurpathak/spring-validation-demo

You can specially have a look at ValidationExceptionMapper and ConstraintViolationExceptionMapper.

Comment From: rstoyanchev

The goal for this component is purely to adapt Standard Validation as a Spring Validator so it can be configured within Spring infrastructure. It is not a good fit for and not a goal to support its use within other frameworks.