【发布时间】:2013-08-20 08:28:03
【问题描述】:
当我实现 MessageInterpolator 时,我没有找到接收正在发生验证的 propertyPath/propertyName 的方法。在某些情况下,我想将 propertyName 添加到错误消息中。
但是,我可以在 ConstraintViolation 的 bean 验证失败后检索它。
propertyName = constraintViolation.getPropertyPath().toString();
如何在消息插值中检索此日期之前?
附:我在 Hibernate 的 JIRA https://hibernate.atlassian.net/browse/BVAL-233 中看到了未解决的问题,所以,我猜没有 clean/standard 方法可以做到这一点......
【问题讨论】:
标签: hibernate validation jpa bean-validation hibernate-validator