java - How to avoid Hibernate Validator ConstraintDeclarationException? -
i have webservice based on spring 4, , using hibernate validator (beyond methodvalidationpostprocessor). problem have clientservice
interface, , implementation. put bean validation constraints on implementation , forces me put constraints on interface (throwing constraintdeclarationexception
) (or in both of them).
i want know 2 things this:
- why work this? why force me put constraints on interface? reason?
- is there way put constraints in implementation?
thanks in advance! regards
to answer first question. behavior specified in bean validation specification section 4.5.5. method constraints in inheritance hierarchies. rule method's preconditions (as represented parameter constraints) must not strengthened in sub types. called liskov substitution principle.
to answer second question, there no way @ moment place constraints on implementation class. there hv-872 suggests implement configurable relaxation of these rules hibernate validator specific feature, not implemented yet.
Comments
Post a Comment