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

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

@@ -2,6 +2,8 @@ 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.RequestBody;
+import org.springframework.web.bind.annotation.ResponseBody;
 import reactor.core.publisher.Mono;
 
 /**
@@ -21,6 +23,7 @@ public class CustomExceptionHandler {
     }
 
     @ExceptionHandler(IllegalAccessException.class)
+    @ResponseBody
     public Mono<String> convertIllegalAccessError(Exception e) {
         //自定义逻辑,可返回其他值
         return Mono.just("illegal access");