当我将@Validated添加到Spring RestConstroller时,我将收到控制器端点的HTTP404响应。在添加注释之前,可以在没有任何问题的情况下找到端点。我使用Spring 5(不是引导),并在类路径上使用hibernate-验证器6.0.16。)
public final ResponseEntity<ApiError> handleConstraintViolationException(final ConstraintViolationException</em
我有一个rest控制器,它有一个包含3个属性的requestObject,它们是强制性的。基本上,下面有一个类,它包含处理@NotBlank异常的方法constraintViolationException。/TODO - to provide custom error message
response.sendError(HttpStatus.BAD_REQUEST.value());当我添加类MyExceptionHandler并发送null属性时,我的re