在hibernate-validator-5.1.3.Final中是否弃用了javax.validation.ConstraintPayload?

时间:2015-03-02 20:57:59

标签: java validation bean-validation

我已下载最新的Bean-Validation API

javax.validation.ConstraintPayload 在最新版本中已弃用。我该用什么呢?

以前工作的片段现在显示为红色,

@Documented
@Constraint(validatedBy = EmailConstraintValidator.class)
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Email {
    String message() default "{validator.email}";

    Class<? extends ConstraintPayload>[] payload() default {};

    Class<?>[] groups() default {};
}

1 个答案:

答案 0 :(得分:1)

看起来你曾经使用过很老的Bean Validation API预览版。从Bean Validation 1.0开始,它是javax.validation.Payload