浏览代码

返回异常页面

plf 4 年之前
父节点
当前提交
84e46e36dc
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/main/java/com/caimei/www/config/CustomExceptionHandler.java

+ 3 - 3
src/main/java/com/caimei/www/config/CustomExceptionHandler.java

@@ -1,7 +1,7 @@
 package com.caimei.www.config;
 
+import org.springframework.web.bind.annotation.ControllerAdvice;
 import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
 import reactor.core.publisher.Mono;
 
 /**
@@ -10,14 +10,14 @@ import reactor.core.publisher.Mono;
  * @author : Charles
  * @date : 2020/8/7
  */
-@RestControllerAdvice
+@ControllerAdvice
 public class CustomExceptionHandler {
 
     @ExceptionHandler(Exception.class)
     public String convertExceptionMsg(Exception e) {
         //自定义逻辑,可返回其他值
         e.printStackTrace();
-        return "404";
+        return "error/404";
     }
 
     @ExceptionHandler(IllegalAccessException.class)