合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
自定义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页面。