ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
自定义403页面步骤如下: **1. 配置类** ```java @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { ... //自定义403页面 http.exceptionHandling().accessDeniedPage("/unauth"); } } ``` **2. controller层** ```java @Controller public class IndexController { @RequestMapping("/unauth") public String unauth() { return "unauth"; } } ``` **3. 测试** 当用户访问不具备权限的资源时就会显示自定义的403页面。