mirror of
https://gitee.com/dromara/sa-token.git
synced 2025-09-21 02:57:56 +08:00
全局异常处理改为rest模式,感谢群友@%%%🤪 发现的bug,@为什么我还是学渣 给出的解决方案
This commit is contained in:
@@ -5,9 +5,9 @@ import java.io.IOException;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
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.ExceptionHandler;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
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.NotLoginException;
|
||||||
import cn.dev33.satoken.exception.NotPermissionException;
|
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 {
|
public class GlobalException {
|
||||||
|
|
||||||
// 在每个控制器之前触发的操作
|
// 在每个控制器之前触发的操作
|
||||||
|
Reference in New Issue
Block a user