全局异常处理改为rest模式,感谢群友@%%%🤪 发现的bug,@为什么我还是学渣 给出的解决方案

This commit is contained in:
shengzhang
2020-10-13 16:11:06 +08:00
parent a6c76bde28
commit 777feb38b2

View File

@@ -5,9 +5,9 @@ import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.exception.NotPermissionException;
@@ -15,7 +15,7 @@ import cn.dev33.satoken.exception.NotPermissionException;
/**
* 全局异常处理
*/
@ControllerAdvice // 可指定包前缀,比如:(basePackages = "com.pj.admin")
@RestControllerAdvice // 可指定包前缀,比如:(basePackages = "com.pj.admin")
public class GlobalException {
// 在每个控制器之前触发的操作