2020
09-30
09-30
Spring Cloud Gateway全局通用异常处理的实现
为什么需要全局异常处理在传统SpringBoot应用中,我们@ControllerAdvice来处理全局的异常,进行统一包装返回//摘至springcloudalibabaconsole模块处理@ControllerAdvicepublicclassConsoleExceptionHandler{@ExceptionHandler(AccessException.class)privateResponseEntity<String>handleAccessException(AccessExceptione){returnResponseEntity.status(HttpStatus.FORBIDDEN).body(e.getErrMsg());...
继续阅读 >