如何覆盖`javax.validation`包中的标准错误代码?

时间:2016-01-01 21:24:38

标签: java validation bean-validation

例如,对于@NotBlank注释,我检索了NotBlank.className.fieldName消息代码,但我需要使用"className.fieldName.canNotBeBlank"覆盖此代码:

@Entity
public class Customer {
..... minimized .....
    @NotNull
    @NotBlank(message = "customer.name.canNotBeBlanc")
    @Size.List({
       @Size(min = 2, message = "customer.name.minimalLengthIs2"),
       @Size(max = 50, message = "customer.name.maxlLengthIs50")
    })
    private String name;
..... minimized .....
}

0 个答案:

没有答案