第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Javax 注釋約束 @ReportAsSingleViolation

Javax 注釋約束 @ReportAsSingleViolation

藍(lán)山帝景 2021-09-15 15:56:15
我使用 Spring 框架和 bean 驗(yàn)證規(guī)范(休眠實(shí)現(xiàn))。考慮到下面的代碼片段,我使用以下方法進(jìn)行了以下觀(guān)察@ReportAsSingleViolation:@ReportAsSingleViolation添加時(shí)僅返回默認(rèn)消息。我的期望是獲得觸發(fā)失敗的消息而不是默認(rèn)消息。當(dāng)我刪除@ReportAsSingleViolation注釋時(shí),一切都按預(yù)期工作。正確返回與違反約束對(duì)應(yīng)的所有錯(cuò)誤消息。這種行為是描述 Bean 驗(yàn)證規(guī)范的一部分還是實(shí)現(xiàn)問(wèn)題?@Target({ElementType.FIELD, ElementType.PARAMETER})@Retention(RetentionPolicy.RUNTIME)@Constraint(validatedBy = {})//@ReportAsSingleViolation@NotBlank(message = "The input cannot be blank")@Pattern(regexp = "[0-9A-Z_]+", message = "The input must content only uppercase, numbers and undescore")@Size(max = 30, message = "The input must be maximal 30")@Documentedpublic @interface MyAnnotation{    String message() default "{com.example.MyAnnotation.message}";    Class<?>[] groups() default { };    Class<? extends Payload>[] payload() default { };}
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 796 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)