在执行某些操作后,将异常从周围方面重新抛出到ExceptionHandlerrest控制器中是否正常,如下所示:
@Around("execution(* *(..)) && @annotation(someAnnotation)")
public Object catchMethod(ProceedingJoinPoint point, SomeAnnotation someAnnotation) throws Throwable {
//some action
try {
result = point.proceed();
} catch (Exception e) {
//some action
throw e; //can I do this?
}
//some action
return result;
}
Run Code Online (Sandbox Code Playgroud)
它正在工作,但我不知道也许出于某种原因我没有这样做。