{"id":9073,"date":"2022-12-13T17:06:34","date_gmt":"2022-12-13T09:06:34","guid":{"rendered":"http:\/\/123.57.164.21\/?p=9073"},"modified":"2022-12-13T17:09:47","modified_gmt":"2022-12-13T09:09:47","slug":"spring-validation%e5%8f%82%e6%95%b0%e6%95%88%e9%aa%8c%e7%9a%84%e5%90%84%e7%a7%8d%e4%bd%bf%e7%94%a8%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=9073","title":{"rendered":"Spring\u00a0Validation\u53c2\u6570\u6548\u9a8c\u7684\u5404\u79cd\u4f7f\u7528\u603b\u7ed3"},"content":{"rendered":"\n<p><strong>\u524d\u8a00<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728\u65e5\u5e38\u7684\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u4e3a\u4e86\u9632\u6b62\u975e\u6cd5\u53c2\u6570\u5bf9\u4e1a\u52a1\u9020\u6210\u7684\u5f71\u54cd\uff0c\u9700\u8981\u5bf9\u63a5\u53e3\u7684\u53c2\u6570\u505a\u5408\u6cd5\u6027\u6821\u9a8c\uff0c\u4f8b\u5982\u5728\u521b\u5efa\u7528\u6237\u65f6\uff0c\u9700\u8981\u6548\u9a8c\u7528\u6237\u7684\u8d26\u53f7\u540d\u79f0\u4e0d\u80fd\u8f93\u5165\u4e2d\u6587\u4e0e\u7279\u6b8a\u5b57\u7b26\uff0c\u624b\u673a\u53f7\u3001\u90ae\u7bb1\u683c\u5f0f\u662f\u5426\u51c6\u786e\u3002\u6309\u7167\u539f\u59cb\u7684\u5904\u7406\u903b\u8f91\u9700\u8981\u5bf9\u6bcf\u4e2a\u63a5\u53e3\u4e2d\u7684\u53c2\u6570\u8fdb\u884c if\/else \u5904\u7406\uff0c\u5982\u679c\u8fd9\u6837\u5f00\u53d1\uff0c\u540e\u671f\u4ee3\u7801\u96be\u4ee5\u7ef4\u62a4\uff0c\u53ef\u8bfb\u6027\u6781\u5dee\u3002<\/p>\n\n\n\n<p>\u4e3a\u4e86\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\uff0cvalidation\u6846\u67b6\u8bde\u751f\u4e86\uff0c\u4ee3\u7801\u91cf\u5927\u5927\u51cf\u5c11\uff0c\u53c2\u6570\u7684\u6548\u9a8c\u4e0d\u518d\u7a7f\u63d2\u4e1a\u52a1\u903b\u8f91\u4ee3\u7801\u4e2d\uff0c\u4ee3\u7801\u7f8e\u89c2\u53c8\u6613\u4e8e\u7ef4\u62a4\u3002<\/p>\n\n\n\n<p><strong>\u57fa\u672c\u6982\u5ff5<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>@Valid \u662f JSR303 \u58f0\u660e\u7684\uff0cJSR\u662fJava Specification Requests\u7684\u7f29\u5199\uff0c\u5176\u4e2d JSR303 \u662fJAVA EE 6 \u4e2d\u7684\u4e00\u9879\u5b50\u89c4\u8303\uff0c\u53eb\u505a Bean Validation\uff0c\u4e3a JavaBean \u9a8c\u8bc1\u5b9a\u4e49\u4e86\u76f8\u5e94\u7684\u5143\u6570\u636e\u6a21\u578b\u548c API\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0cJSR \u53ea\u662f\u4e00\u9879\u6807\u51c6\uff0c\u5b83\u89c4\u5b9a\u4e86\u4e00\u4e9b\u6821\u9a8c\u6ce8\u89e3\u7684\u89c4\u8303\uff0c\u4f46\u6ca1\u6709\u5b9e\u73b0\uff0c\u800c Hibernate validation \u5bf9\u5176\u8fdb\u884c\u5b9e\u73b0\u3002<\/p>\n\n\n\n<p>Spring Validation \u9a8c\u8bc1\u6846\u67b6\u5bf9\u53c2\u6570\u7684\u9a8c\u8bc1\u673a\u5236\u63d0\u4f9b\u4e86@Validated\uff08Spring JSR-303\u89c4\u8303\uff0c\u662f\u6807\u51c6JSR-303\u7684\u4e00\u4e2a\u53d8\u79cd\uff09\u3002<\/p>\n\n\n\n<p><strong>@Valid\u548c@Validated\u533a\u522b<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-1024x179.png\" alt=\"\" class=\"wp-image-9074\" width=\"531\" height=\"92\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-1024x179.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-300x53.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-768x135.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-1536x269.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-830x145.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-230x40.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-350x61.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67-480x84.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-67.png 1552w\" sizes=\"(max-width: 531px) 100vw, 531px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u57fa\u672c\u4f7f\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>\u52a0\u5165\u4f9d\u8d56<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;dependency>\n    &lt;groupId>org.springframework.boot&lt;\/groupId>\n    &lt;artifactId>spring-boot-starter-web&lt;\/artifactId>\n    &lt;version>2.3.12.RELEASE&lt;\/version>\n&lt;\/dependency>\n\n&lt;dependency>\n    &lt;groupId>org.projectlombok&lt;\/groupId>\n    &lt;artifactId>lombok&lt;\/artifactId>\n    &lt;version>1.18.10&lt;\/version>\n&lt;\/dependency><\/pre>\n\n\n\n<p>\u6ce8\uff1a\u4ece boot-2.3.x\u5f00\u59cb\uff0cspring-boot-starter-web\u4e0d\u518d\u5f15\u5165 spring-boot-starter-validation\uff0c\u6240\u4ee5\u9700\u8981\u989d\u5916\u624b\u52a8\u5f15\u5165validation\u4f9d\u8d56\uff0c\u800c 2.3\u4e4b\u524d\u7684\u7248\u672c\u53ea\u9700\u8981\u5f15\u5165 web \u4f9d\u8d56\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;dependency>\n\t&lt;groupId>org.springframework.boot&lt;\/groupId>\n\t&lt;artifactId>spring-boot-starter-validation&lt;\/artifactId>\n\t&lt;version>2.3.12.RELEASE&lt;\/version>\n&lt;\/dependency>\n    \n&lt;!-- &lt;dependency>\n\t&lt;groupId>org.hibernate.validator&lt;\/groupId>\n\t&lt;artifactId>hibernate-validator&lt;\/artifactId>\n\t&lt;version>6.0.18.Final&lt;\/version>\n\t&lt;scope>compile&lt;\/scope>\n&lt;\/dependency>--><\/pre>\n\n\n\n<p>\u4ee5\u4e0a\u4e24\u4e2a\u4f9d\u8d56\u90fd\u662f\u53ef\u4ee5\u5b9e\u73b0\u529f\u80fd\u7684\u3002hibernate-validator\u3001spring-boot-starter-validation\u5e95\u5c42\u90fd\u5f15\u5165\u4e86 jakarta.validation-api\u4f9d\u8d56\u3002<\/p>\n\n\n\n<p>\u5728\u5b9e\u9645\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u8bf7\u6c42\u53c2\u6570\u7684\u683c\u5f0f\u4e00\u822c\u6709\u5982\u4e0b\u51e0\u79cd\u60c5\u51b5\uff1a<\/p>\n\n\n\n<p><strong>\u5bf9\u8c61\u53c2\u6570\u4f7f\u7528<\/strong><\/p>\n\n\n\n<p>\u4f7f\u7528\u5bf9\u8c61\u53c2\u6570\u63a5\u6536\u5206\u4e3a\u4e24\u79cd\uff0c\u4e00\u79cd\u662f\u4f7f\u7528 @RequestBody\u6ce8\u89e3\u7684application\/json\u63d0\u4ea4\uff0c\u8fd8\u6709\u4e00\u79cd\u4e0d\u4f7f\u7528 @RequestBody\u6ce8\u89e3\u7684 form-data\u63d0\u4ea4\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u5bf9\u8c61\u63a5\u6536\u53c2\u6570\uff0c\u5728\u9700\u8981\u6821\u9a8c\u5bf9\u8c61\u7684\u53c2\u6570\u52a0\u4e0a @NotBlank\u6ce8\u89e3\uff0cmessage\u662f\u6821\u9a8c\u4e0d\u901a\u8fc7\u7684\u63d0\u793a\u4fe1\u606f\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Data\npublic class UserReq {\n    @NotBlank(message = \"name\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String name;\n    @NotBlank(message = \"email\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String email;\n}<\/pre>\n\n\n\n<p><strong>\u4f7f\u7528 @RequestBody<\/strong><\/p>\n\n\n\n<p>Api\uff0c\u5728\u9700\u8981\u6821\u9a8c\u7684\u5bf9\u8c61\u524d\u9762\u52a0 @RequestBody\u6ce8\u89e3\u4ee5\u53ca@Validated\u6216\u8005@Valid\u6ce8\u89e3\uff0c\u5982\u679c\u6821\u9a8c\u5931\u8d25\uff0c\u4f1a\u629b\u51faMethodArgumentNotValidException\u5f02\u5e38\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@RestController\npublic class GetHeaderController {\n    @PostMapping(\"save\")\n    public void save(@RequestBody @Validated UserReq req){}\n}<\/pre>\n\n\n\n<p><strong>\u4e0d\u4f7f\u7528 @RequestBody<\/strong><\/p>\n\n\n\n<p>\u53ea\u9700\u8981\u6821\u9a8c\u7684\u5bf9\u8c61\u524d\u9762\u52a0@Validated\u6ce8\u89e3\u6216\u8005@Valid\u6ce8\u89e3\uff0c\u5982\u679c\u6821\u9a8c\u5931\u8d25\uff0c\u4f1a\u629b\u51faBindException\u5f02\u5e38\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@PostMapping(\"save2\")\npublic void save2(@Validated UserReq req){\n}<\/pre>\n\n\n\n<p><strong>\u57fa\u672c\u7c7b\u578b\u4f7f\u7528<\/strong><\/p>\n\n\n\n<p>\u5176\u5b9e\u4e5f\u5c31\u662f\u8def\u5f84\u4f20\u53c2\uff0c\u5728\u53c2\u6570\u524d\u9762\u52a0\u4e0a\u76f8\u5bf9\u5e94\u7684\u6821\u9a8c\u6ce8\u89e3\uff0c\u8fd8\u5fc5\u987b\u5728Controller\u7c7b\u4e0a\u52a0 @Validated\u6ce8\u89e3\u3002\u5982\u679c\u6821\u9a8c\u5931\u8d25\uff0c\u4f1a\u629b\u51faConstraintViolationException\u5f02\u5e38\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@RestController\n@Validated\npublic class GetHeaderController {\n    @PostMapping(\"get\")\n    public void get(@NotBlank(message = \"\u540d\u79f0 is required\") String name,@NotBlank(message = \"\u90ae\u7bb1 is required\") String email) throws JsonProcessingException {\n\n    }\n}<\/pre>\n\n\n\n<p><strong>\u5168\u5c40\u5f02\u5e38\u5904\u7406<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u901a\u8fc7\u524d\u9762\u7684\u6d4b\u8bd5\uff0c\u6211\u4eec\u77e5\u9053\u5982\u679c\u53c2\u6570\u6821\u9a8c\u5931\u8d25\uff0c\u4e09\u79cd\u4f7f\u7528\u573a\u666f\u4f1a\u629b\u51fa\u4e09\u79cd\u5f02\u5e38\u6216\u8005\u8b66\u544a\uff0c\u5206\u522b\u662fMethodArgumentNotValidException\u3001ConstraintViolationException\u3001BindException\u5f02\u5e38\uff0c\u6bcf\u79cd\u5f02\u5e38\u7684\u54cd\u5e94\u683c\u5f0f\u53c8\u4e0d\u4e00\u81f4\u3002\u6240\u4ee5\u5728\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528\u7edf\u4e00\u5f02\u5e38\u5904\u7406\u6765\u8fd4\u56de\u4e00\u4e2a\u7edf\u4e00\u683c\u5f0f\u5e76\u53cb\u597d\u7684\u63d0\u793a\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@RestControllerAdvice\npublic class GlobalExceptionHandler {\n    \/**\n     * @RequestBody \u4e0a\u6821\u9a8c\u5931\u8d25\u540e\u629b\u51fa\u7684\u5f02\u5e38\u662f MethodArgumentNotValidException \u5f02\u5e38\u3002\n     *\/\n    @ExceptionHandler(MethodArgumentNotValidException.class)\n    public String handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {\n        BindingResult bindingResult = e.getBindingResult();\n        String messages = bindingResult.getAllErrors()\n                .stream()\n                .map(ObjectError::getDefaultMessage)\n                .collect(Collectors.joining(\"\uff1b\"));\n        return messages;\n    }\n    \/**\n     * \u4e0d\u52a0 @RequestBody\u6ce8\u89e3\uff0c\u6821\u9a8c\u5931\u8d25\u629b\u51fa\u7684\u5219\u662f BindException\n     *\/\n    @ExceptionHandler(value = BindException.class)\n    public String exceptionHandler(BindException e){\n        String messages = e.getBindingResult().getAllErrors()\n                .stream()\n                .map(ObjectError::getDefaultMessage)\n                .collect(Collectors.joining(\"\uff1b\"));\n        return messages;\n    }\n\n    \/**\n     *  @RequestParam \u4e0a\u6821\u9a8c\u5931\u8d25\u540e\u629b\u51fa\u7684\u5f02\u5e38\u662f ConstraintViolationException\n     *\/\n    @ExceptionHandler({ConstraintViolationException.class})\n    public String methodArgumentNotValid(ConstraintViolationException exception) {\n        String message = exception.getConstraintViolations().stream().map(ConstraintViolation::getMessage).collect(Collectors.joining(\"\uff1b\"));\n        return message;\n    }\n}<\/pre>\n\n\n\n<p>\u53ef\u4ee5\u53d1\u73b0\u5b83\u662f\u5c06\u7c7b\u4e2d\u6240\u6709\u7684\u5c5e\u6027\u8fdb\u884c\u6548\u9a8c\u5b8c\u6210\u4e4b\u540e\uff0c\u624d\u629b\u51fa\u5f02\u5e38\u7684\uff0c\u4f46\u5176\u5b9e\u8fd9\u6709\u70b9\u6d88\u8017\u6027\u80fd\uff0c\u90a3\u80fd\u4e0d\u80fd\u53ea\u8981\u68c0\u6d4b\u5230\u4e00\u4e2a\u6548\u9a8c\u4e0d\u901a\u8fc7\u7684\uff0c\u5c31\u629b\u51fa\u5f02\u5e38\u5462\uff1f\u53ea\u9700\u8981\u5728\u5bb9\u5668\u63d0\u4f9b\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Configuration\npublic class ParamValidatorConfig {\n    @Bean\n    public Validator validator() {\n        ValidatorFactory validatorFactory = Validation.byProvider(HibernateValidator.class)\n                .configure()\n                \/\/failFast\uff1a\u53ea\u8981\u51fa\u73b0\u6821\u9a8c\u5931\u8d25\u7684\u60c5\u51b5\uff0c\u5c31\u7acb\u5373\u7ed3\u675f\u6821\u9a8c\uff0c\u4e0d\u518d\u8fdb\u884c\u540e\u7eed\u7684\u6821\u9a8c\u3002\n                .failFast(true)\n                .buildValidatorFactory();\n        return validatorFactory.getValidator();\n    }\n\n    @Bean\n    public MethodValidationPostProcessor methodValidationPostProcessor() {\n        MethodValidationPostProcessor methodValidationPostProcessor = new MethodValidationPostProcessor();\n        methodValidationPostProcessor.setValidator(validator());\n        return methodValidationPostProcessor;\n    }\n\n}<\/pre>\n\n\n\n<p>MethodValidationPostProcessor\u662fSpring\u63d0\u4f9b\u7684\u6765\u5b9e\u73b0\u57fa\u4e8e\u65b9\u6cd5Method\u7684JSR\u6821\u9a8c\u7684\u6838\u5fc3\u5904\u7406\u5668\uff0c\u6700\u7ec8\u4f1a\u7531 MethodValidationInterceptor\u8fdb\u884c\u6821\u9a8c\u62e6\u622a\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528\u5206\u7ec4\u6548\u9a8c<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u6709\u4e9b\u5c0f\u4f19\u4f34\u8bf4\u4f7f\u7528 @Validated\u6821\u9a8c\u7684\u5bf9\u8c61\u4e0d\u80fd\u590d\u7528\uff0c\u8fd9\u6211\u53ea\u80fd\u8bf4\u5b66\u7684\u8fd8\u4e0d\u591f\u6df1\u5165\u3002<\/p>\n\n\n\n<p>\u5c0f\u6770\u4f7f\u7528 PayReq\u6765\u4e3e\u4f8b\uff0c\u8be5\u5bf9\u8c61\u662f\u4e00\u4e2a\u516c\u7528\u7684\u8bf7\u6c42\u4f53\uff0c\u5bf9\u63a5\u4e86\u5fae\u4fe1\u3001\u652f\u4ed8\u5b9d\u4e24\u4e2a\u6e20\u9053\u65b9\uff0c<strong>\u5bf9\u63a5\u5fae\u4fe1 payName\u53c2\u6570\u662f\u975e\u5fc5\u4f20\u7684\uff0c\u5bf9\u63a5\u652f\u4ed8\u5b9d\u662f\u5fc5\u4f20\u53c2\u6570\u3002payAmount\u662f\u4e24\u4e2a\u6e20\u9053\u5fc5\u4f20\u53c2\u6570<\/strong>\u3002\u5176\u5b9e\u5c31\u8ddf\u5e73\u5e38\u5199\u65b0\u589e\u65b9\u6cd5\u3001\u4fee\u6539\u65b9\u6cd5\u4e00\u6837\u7684\uff0c\u7528\u7684\u662f\u540c\u4e00\u4e2a ReqDTO\uff0c\u4f46\u662f\u5176\u4e2d id \u5b57\u6bb5\u65b0\u589e\u662f\u4e0d\u7528\u4f20\u9012\u7684\uff0c\u800c\u4fee\u6539\u65f6\u662f\u5fc5\u4f20\u7684\u3002<\/p>\n\n\n\n<p><strong>\u5b9a\u4e49 ZfbPayGroup<\/strong><\/p>\n\n\n\n<p>\u5b9a\u4e49ZfbPayGroup\u7684\u5206\u7ec4\u63a5\u53e3\uff0c\u7ee7\u627f Default\u63a5\u53e3\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public interface ZfbPayGroup extends Default {\n}<\/pre>\n\n\n\n<p><strong>\u6dfb\u52a0group<\/strong><\/p>\n\n\n\n<p>\u5728\u9700\u8981\u533a\u5206\u7ec4\u7684\u5b57\u6bb5\u4e0a\u52a0 groups \u53c2\u6570\u3002\u5728\u672c\u4f8b\u4e2d\u5728 payName\u52a0\u4e86groups \u53c2\u6570\uff0c\u503c\u4e3a ZfbPayGroup.class\uff0c\u4ee3\u8868\u5bf9\u7ec4\u4e3a ZfbPayGroup\u7684\u8fdb\u884cpayNam<code>e<\/code>\u53c2\u6570\u6821\u9a8c\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Data\npublic class PayReq {\n    @NotBlank(message = \"\u652f\u4ed8\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\",groups = {ZfbPayGroup.class})\n    private String payName;\n\n    @NotNull(message = \"\u652f\u4ed8\u91d1\u989d\u4e0d\u80fd\u4e3a\u7a7a\")\n    private BigDecimal payAmount;\n\n}<\/pre>\n\n\n\n<p>\u6ce8\u610f\uff1aZfbPayGroup \u8981\u7ee7\u627f Default\u63a5\u53e3\uff0c\u4e0d\u7136 payAmount\u5b57\u6bb5\u7684\u6548\u9a8c\u4f1a\u5bf9ZfbPayGroup\u8fd9\u4e2a\u7ec4\u5931\u6548\uff0cpayAmount\u9ed8\u8ba4\u7684\u7ec4\u4e3a Default\u3002<\/p>\n\n\n\n<p><strong>\u4f7f\u7528 group<\/strong><\/p>\n\n\n\n<p>\u521b\u5efa\u4e24\u4e2a\u63a5\u53e3\uff0c\u5728 zfbPaySave\u63a5\u53e3\u4e2d\u58f0\u660e@Validated\u6821\u9a8c\u7ec4\uff0cwxbPaySave\u63a5\u53e3\u6b63\u5e38\u7f16\u5199\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@PostMapping(\"zfbPaySave\")\npublic void zfbPaySave(@RequestBody @Validated(value = {ZfbPayGroup.class}) PayReq req) throws JsonProcessingException {\n    ObjectMapper mapper = new ObjectMapper();\n\n    System.out.println( mapper.writeValueAsString(req));\n}\n@PostMapping(\"wxbPaySave\")\npublic void wxbPaySave(@RequestBody @Validated PayReq req) throws JsonProcessingException {\n    ObjectMapper mapper = new ObjectMapper();\n\n    System.out.println( mapper.writeValueAsString(req));\n}<\/pre>\n\n\n\n<p><strong>\u6d4b\u8bd5<\/strong><\/p>\n\n\n\n<p>zfbPaySave\uff1a\u63d0\u793a\u652f\u4ed8\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-1024x706.png\" alt=\"\" class=\"wp-image-9076\" width=\"519\" height=\"358\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-1024x706.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-300x207.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-768x529.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-1536x1059.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-830x572.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-230x159.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-350x241.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68-480x331.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-68.png 1660w\" sizes=\"(max-width: 519px) 100vw, 519px\" \/><\/figure><\/div>\n\n\n\n<p>wxbPaySave\uff1a\u6ca1\u88ab\u6821\u9a8c\u62e6\u622a\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-1024x806.png\" alt=\"\" class=\"wp-image-9077\" width=\"489\" height=\"385\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-1024x806.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-300x236.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-768x604.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-1536x1208.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-830x653.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-230x181.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-350x275.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69-480x378.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-69.png 1650w\" sizes=\"(max-width: 489px) 100vw, 489px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u5d4c\u5957\u6821\u9a8c<\/strong><\/p>\n\n\n\n<p>\u4ec0\u4e48\u662f\u5d4c\u5957\u4f7f\u7528\u5462\uff1f\u5c31\u662f\u4e00\u4e2a\u5bf9\u8c61\u4e2d\u5305\u542b\u53e6\u5916\u4e00\u4e2a\u5bf9\u8c61\uff0c\u53e6\u5916\u4e00\u4e2a\u5bf9\u8c61\u7684\u5b57\u6bb5\u4e5f\u662f\u9700\u8981\u8fdb\u884c\u6821\u9a8c\u3002\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n\n\n\n<p>UserReq<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Data\npublic class UserReq {\n    @NotBlank(message = \"name\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String name;\n\n    private String email;\n    \n    @NotNull(message = \"proReq\u5bf9\u8c61\u4e0d\u80fd\u4e3a\u7a7a\")\n    @Valid\n    private ProReq proReq;\n}<\/pre>\n\n\n\n<p>\u5d4c\u5957\u6821\u9a8c\u9700\u8981\u5728\u6548\u9a8c\u7684\u5bf9\u8c61<strong>\u52a0\u4e0a @Valid \u6ce8\u89e3<\/strong>\u3002<\/p>\n\n\n\n<p>ProReq<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Data\npublic class ProReq {\n    @NotBlank(message = \"proName\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String proName;\n}<\/pre>\n\n\n\n<p><strong>\u6d4b\u8bd5<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-1024x912.png\" alt=\"\" class=\"wp-image-9078\" width=\"408\" height=\"364\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-1024x912.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-300x267.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-768x684.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-830x739.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-230x205.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-350x312.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70-480x427.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-70.png 1298w\" sizes=\"(max-width: 408px) 100vw, 408px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u96c6\u5408\u6821\u9a8c<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u96c6\u5408\u63a5\u6536\u524d\u7aef\u4f20\u9012\u7684\u53c2\u6570\uff0c\u5e76\u5bf9\u96c6\u5408\u4e2d\u7684\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u8fdb\u884c\u53c2\u6570\u6821\u9a8c\u3002\u4f46\u662f\u8fd9\u65f6\u6211\u4eec\u7684\u53c2\u6570\u6821\u9a8c\u5e76\u4e0d\u4f1a\u751f\u6548\uff01\u5982\u4e0b\u5199\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@PostMapping(\"save3\")\npublic String save3(@RequestBody @Validated List&lt;UserReq> req){\n    return \"\u6210\u529f\";\n}<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-1024x903.png\" alt=\"\" class=\"wp-image-9079\" width=\"422\" height=\"372\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-1024x903.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-300x265.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-768x677.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-830x732.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-230x203.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-350x309.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71-480x423.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-71.png 1222w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/figure><\/div>\n\n\n\n<p>\u4e0b\u9762\u4ecb\u7ecd\u4e24\u79cd\u65b9\u5f0f\u5bf9\u96c6\u5408\u8fdb\u884c\u6548\u9a8c\uff01<\/p>\n\n\n\n<p><strong>\u65b9\u5f0f\u4e00<\/strong><\/p>\n\n\n\n<p>@Validated + @Valid\u4e24\u4e2a\u6ce8\u89e3\u540c\u65f6\u4f7f\u7528\uff01\u7f3a\u70b9\uff1a<strong>\u4e0d\u80fd\u4f7f\u7528\u5206\u7ec4\u6548\u9a8c<\/strong>\uff01\u5982\u679c\u8be5\u5b9e\u4f53\u4e0d\u9700\u8981\u7528\u5230\u5206\u7ec4\u529f\u80fd\uff0c\u53ef\u4ee5\u4f7f\u7528\u8be5\u65b9\u5f0f\uff01<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@RestController\n@Validated\npublic class GetHeaderController {\n    @PostMapping(\"save3\")\n    public String save3(@RequestBody @Valid @NotEmpty(message = \"\u8be5\u96c6\u5408\u4e0d\u80fd\u4e3a\u7a7a\") List&lt;UserReq> req){\n        return \"\u6210\u529f\";\n    }\n}<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-1024x962.png\" alt=\"\" class=\"wp-image-9080\" width=\"417\" height=\"392\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-1024x962.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-300x282.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-768x722.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-830x780.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-230x216.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-350x329.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72-480x451.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-72.png 1298w\" sizes=\"(max-width: 417px) 100vw, 417px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u65b9\u5f0f\u4e8c<\/strong><\/p>\n\n\n\n<p>\u81ea\u5b9a\u4e49\u4e00\u4e2aList<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Data\npublic class ValidList&lt;E> implements List&lt;E> {\n    \/\/ \u4f7f\u7528\u8be5\u6ce8\u89e3\u5c31\u4e0d\u9700\u8981\u624b\u52a8\u91cd\u65b0 List \u4e2d\u7684\u65b9\u6cd5\u4e86\n    @Delegate\n    @Valid\n    public List&lt;E> list = new ArrayList&lt;>();\n    \n}<\/pre>\n\n\n\n<p>@Delegate\uff0c\u4e3a lombok \u7684\u6ce8\u89e3\uff0c\u8868\u793a\u8be5\u5c5e\u6027\u7684\u6240\u6709\u5bf9\u8c61\u7684\u5b9e\u4f8b\u65b9\u6cd5\u90fd\u5c06\u88ab\u8be5\u7c7b\u4ee3\u7406\u3002\u7f16\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@PostMapping(\"save4\")\npublic String save4(@RequestBody @Validated @NotEmpty(message = \"\u8be5\u96c6\u5408\u4e0d\u80fd\u4e3a\u7a7a\") ValidList&lt;UserReq> req){\n    return \"\u6210\u529f\";\n}<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-857x1024.png\" alt=\"\" class=\"wp-image-9081\" width=\"375\" height=\"448\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-857x1024.png 857w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-251x300.png 251w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-768x918.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-830x992.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-230x275.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-350x418.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73-480x574.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-73.png 1126w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u81ea\u5b9a\u4e49\u6821\u9a8c\u89c4\u5219<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u81ea\u5b9a\u4e49\u6821\u9a8c\u89c4\u5219\u5c0f\u6770\u5728\u5de5\u4f5c\u5f53\u4e2d\u7528\u7684\u6bd4\u8f83\u5c11\u3002\u5927\u90e8\u5206\u4e1a\u52a1\u9700\u6c42\u4f7f\u7528\u81ea\u5e26\u7684\u6ce8\u89e3\u5df2\u7ecf\u591f\u5e73\u5e38\u5f00\u53d1\u4e86\u3002\u5f53\u7136\u81ea\u5b9a\u4e49validation\u89c4\u5219\u4e5f\u975e\u5e38\u7b80\u5355\u3002\u8fd9\u91cc\u4f7f\u7528<strong>\u6821\u9a8c\u7535\u8bdd\u53f7\u7801\u662f\u5426\u5408\u6cd5<\/strong>\u6765\u4e3e\u4f8b\uff01\u522b\u62ac\u6760\uff0c\u8bf4\u6211\u4e3a\u4ec0\u4e48\u4e0d\u7528 <code>@Pattern(regexp = \"^1[3456789]\\\\d{9}$\",message = \"\u624b\u673a\u53f7\u683c\u5f0f\u4e0d\u6b63\u786e\")<\/code>\u76f4\u63a5\u5b9e\u73b0\u3002\u5bf9\u4e0d\u8d77\uff0c\u6211\u4e0d\u60f3\u6bcf\u6b21\u5199\u6b63\u5219\u3002<\/p>\n\n\n\n<ul><li>\u81ea\u5b9a\u4e49\u6ce8\u89e3 Phone\uff0c\u8ddf\u7740\u5185\u7f6e\u7684\u6ce8\u89e3\u7167\u846b\u82a6\u753b\u74e2\u3002\u4e0d\u8fc7 validatedBy\u7684\u503c\u8981\u6307\u5b9a\u6211\u4eec\u81ea\u5b9a\u4e49\u7684<strong>\u7ea6\u675f\u9a8c\u8bc1\u5668<\/strong>\uff01<\/li><\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })\n@Retention(RUNTIME)\n@Documented\n@Constraint(validatedBy = { PhoneValidator.class })\npublic @interface Phone {\n\n\n    String message() default \"\u624b\u673a\u53f7\u7801\u683c\u5f0f\u5f02\u5e38\";\n\n    Class&lt;?>[] groups() default { };\n\n    Class&lt;? extends Payload>[] payload() default { };\n\n}<\/pre>\n\n\n\n<p>\u5b9e\u73b0ConstraintValidator\u7ea6\u675f\u9a8c\u8bc1\u5668\u63a5\u53e3<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">public class PhoneValidator implements ConstraintValidator&lt;Phone,String> {\n    private static final String REGEX = \"^1[3456789]\\\\\\\\d{9}$\";\n    \/**\n     *\n     * @param value\n     * @param context\n     * @return\uff1a\u8fd4\u56de true \u8868\u793a\u6548\u9a8c\u901a\u8fc7\n     *\/\n    @Override\n    public boolean isValid(String value, ConstraintValidatorContext context) {\n        \/\/ \u4e0d\u4e3anull\u624d\u8fdb\u884c\u6821\u9a8c\n        if (value != null) {\n            return value.matches(REGEX);\n        }\n        return true;\n    }\n}<\/pre>\n\n\n\n<p>\u63a5\u4e0b\u6765\u5c31\u53ef\u4ee5\u4f7f\u7528 @Phone\u6ce8\u89e3\u4e86\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">@Data\npublic class UserReq {\n    @NotBlank(message = \"name\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String name;\n\n    @Email(message = \"email\u683c\u5f0f\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u586b\u5199\")\n    @NotBlank(message = \"email\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String email;\n\n    @NotNull(message = \"proReq\u5bf9\u8c61\u4e0d\u80fd\u4e3a\u7a7a\")\n    @Valid\n    private ProReq proReq;\n    \n    @Phone\n    @NotBlank(message = \"\u624b\u673a\u53f7\u7801\u4e3a\u5fc5\u4f20\u53c2\u6570\")\n    private String tel;\n}<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-990x1024.png\" alt=\"\" class=\"wp-image-9082\" width=\"444\" height=\"458\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-990x1024.png 990w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-290x300.png 290w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-768x794.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-230x238.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-350x362.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74-480x496.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2022\/12\/\u56fe\u7247-74.png 1164w\" sizes=\"(max-width: 444px) 100vw, 444px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u5728\u65e5\u5e38\u7684\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u4e3a\u4e86\u9632\u6b62\u975e\u6cd5\u53c2\u6570\u5bf9\u4e1a\u52a1\u9020\u6210\u7684\u5f71\u54cd\uff0c\u9700\u8981\u5bf9\u63a5\u53e3\u7684\u53c2\u6570\u505a\u5408\u6cd5\u6027\u6821\u9a8c\uff0c\u4f8b\u5982\u5728\u521b\u5efa\u7528\u6237\u65f6\uff0c\u9700 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,27],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9073"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9073"}],"version-history":[{"count":3,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9073\/revisions"}],"predecessor-version":[{"id":9084,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/9073\/revisions\/9084"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}