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:

  1. why work this? why force me put constraints on interface? reason?
  2. 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

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -