Java Bean Validation: How do I specify multiple validation constraints of the same type but with different groups?

后端 未结 1 496
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 23:10

I have multiple processes in which the bean properties must have different values. Example:

@Min( value=0, groups=ProcessA.class )
@Min( value=20, groups=Pro         


        
1条回答
  •  伪装坚强ぢ
    2021-01-17 23:46

    The syntax for Min.List, as for any other annotation taking an array of annotations as one of its attributes, is

    @Min.List({ @Min(value = 0, groups = ProcessA.class),
                @Min(value = 20, groups = ProcessB.class) })
    

    0 讨论(0)
提交回复
热议问题