关闭springsecurity
时间: 2023-08-20 12:04:56 浏览: 163
要关闭Spring Security,可以通过以下步骤来实现。
1.在Spring Boot的主启动类中增加配置。可以在@SpringBootApplication注解中添加exclude参数,将SecurityAutoConfiguration.class排除在外。这样就可以禁用Spring Security的自动配置。 [1]
2.通过拦截器来关闭权限框架的token校验。不论是哪个授权方式,都是基于拦截器做处理的。可以创建一个类继承WebMvcConfigurer,并重写addInterceptors方法。在该方法中,配置拦截器并放行需要放行的接口。例如,可以创建一个MyMvcConfig类,并在addInterceptors方法中添加代码来配置拦截器并放行部分接口。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [SpringBoot如何关闭Spring Security](https://blog.csdn.net/weixin_50165209/article/details/124436233)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [如何关闭SpringSecurity的权限认证](https://blog.csdn.net/weixin_43756775/article/details/121426332)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文