Using both JSR-303 and Traditional Bean Validation?

前端 未结 3 897
陌清茗
陌清茗 2020-12-31 13:59

Is it possible to use both JSR-303 bean validation and traditional validation (a single validator class for the type) in Spring? If so, what configuration is required to se

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-31 14:13

    I've done that following the instructions here:

    http://blog.jteam.nl/2009/08/04/bean-validation-integrating-jsr-303-with-spring/

    See the "Enjoy both worlds" section. Shortly, you explicitly run a JSR303 validation from a Spring validator, "joining" the results of JSR303 validations based on annotations and your custom validation logic.

提交回复
热议问题