除了使用类级验证之外,有没有办法从验证器类中访问字段级验证注释的父bean?
例如:
public class CustomValidator implements ConstraintValidator<CustomValidation, String> {
@Override
public void initialize(final CustomValidation constraintAnnotation) {
}
@Override
public boolean isValid(final String fieldValue, final ConstraintValidatorContext context) {
// is there a way to access the parent object here?
}
}
答案 0 :(得分:2)
经过进一步调查,结果证明这不适用于规范1.1版。