How do I construct a ConstraintViolationException in Bean Validation 1.0?

前端 未结 2 614
遇见更好的自我
遇见更好的自我 2021-02-12 19:26

I am puzzled by the javax.validation API. I am writing a simple test to understand it:

Sample sample = new Sample();
Set>          


        
2条回答
  •  醉梦人生
    2021-02-12 20:13

    You can work around this like so:

    throw new ConstraintViolationException(
        new HashSet>(violations));
    

    You may be interested in tracking BVAL-198 which addresses this issue.

提交回复
热议问题