Empty validatedBy in @Constraint

后端 未结 2 731
长情又很酷
长情又很酷 2021-02-04 03:11

I noticed that all built-in constraints have an empty value for the validatedBy parameter in @Constraint. i.e. @Constraint(validatedBy = {})

2条回答
  •  -上瘾入骨i
    2021-02-04 03:36

    Maybe have a look at this answer:

    How to avoid cross dependency between layers because of @Constraint validatedBy?

    And those two links:

    Adding constraints programmatically: http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html/validator-specifics.html#section-programmatic-api

    Adding constraints per xml: http://docs.jboss.org/hibernate/validator/4.1/reference/en-US/html/validator-xmlconfiguration.html

提交回复
热议问题