/**
* 400 - Bad Request
*/
@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(ConstraintViolationException.class)
public ResponseEntity handleServiceException(ConstraintViolationException e) {
LOGGER.error("参数验证失败", e);
Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
ConstraintViolation<?> violation = violations.iterator().next();
String message = violation.getMessage();
return ResponseEntity.badRequest().body("parameter:" + message);
}
GlobalHandler.java 文件源码
java
阅读 17
收藏 0
点赞 0
评论 0
项目:spring-boot-jwt-jpa
作者:
评论列表
文章目录