为了账号安全,请及时绑定邮箱和手机立即绑定

Spring-boot:未到达 RestControllerAdvise

Spring-boot:未到达 RestControllerAdvise

HUH函数 2021-08-04 09:43:46
我已经建立了一个RestControlerAdvise:@RestControllerAdvice@Order(Ordered.HIGHEST_PRECEDENCE)public class ExceptionControllerAdvice {    @ExceptionHandler({DocumentAlreadyExistsException.class})    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)    public cat.gencat.ctti.canigo.arch.web.rs.model.Error handleException(DocumentAlreadyExistsException e) {        cat.gencat.ctti.canigo.arch.web.rs.model.Error error = new cat.gencat.ctti.canigo.arch.web.rs.model.Error();        error.setCode(HttpStatus.BAD_REQUEST.value());        error.setMessage(e.getMessage());        return error;    }}尽管如此,即使我提出了DocumentAlreadyExistException.在启动时检测到:2018-08-20 17:08:25.791 INFO 4941 --- [main] .mmaExceptionHandlerExceptionResolver:在 exceptionControllerAdvice 中检测到 @ExceptionHandler 方法有任何想法吗?
查看完整描述

2 回答

?
侃侃尔雅

TA贡献1801条经验 获得超16个赞

您可能正在处理 DocumentAlreadyExistException 而不是将其抛出以供 spring 处理。


查看完整回答
反对 回复 2021-08-04
  • 2 回答
  • 0 关注
  • 170 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信