Spring Boot: accessDeniedHandler does not work

前端 未结 4 954
北荒
北荒 2020-12-14 20:44

I\'ve got the following Spring Security configuration:

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter          


        
4条回答
  •  盖世英雄少女心
    2020-12-14 21:00

    Use this:-

    @Configuration
    public class ViewRegistryConfig implements WebMvcConfigurer {
    
        @Override
        public void addViewControllers(ViewControllerRegistry registry) {
            registry.addViewController("/403").setViewName("notAuth");
        }
    
    }
    

    and create notAuth.html page in your template folder

提交回复
热议问题