【发布时间】:2021-09-29 12:56:32
【问题描述】:
我正在使用休眠动态模型来创建 CRUD。我想知道如何验证 http 请求 (@Valid) 注释,因为我没有任何实体或 DTO。
@PostMapping("/signup")
public ResponseEntity<RestResponse> signup(@Valid @RequestBody Map<String, Object> user) {
var restResponse = new RestResponse<>();
restResponse.setStatusCode(HttpStatus.OK.value());
restResponse.setResponse(user);
return ResponseEntity.status(HttpStatus.OK)
.body(restResponse);
}
【问题讨论】:
标签: spring-boot hibernate hibernate-validator