SpringBoot中针对List内的每个对象的@Valid校验

2021-04-19 18:15:45
接收参数正常使用@Valid注解,在Controller上额外添加@Validated注解即可 ```java @RestController @Validated public class UserController { @PostMapping("/api/create") public JsonResult create(@RequestBody @Valid List<User> list){ xxxxxxxxxxxxx return new JsonResult(); } } ```