多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 1. 编写 失败注销用户处理器 并且继承 LogoutSuccessHandler 实现 onLogoutSuccess ~~~ @Component public class WebLogoutSuccessHandler implements LogoutSuccessHandler { @Override public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { System.out.println("退出登录"); } } ~~~ ### 2 .配置 ~~~ /* http.logout()// 退出 .logoutSuccessHandler(logoutSuccessHandler) // 触发注销发生的请求匹配器 // 退出地址 只能设置一个 // .logoutUrl("/logout") .logoutRequestMatcher(new AntPathRequestMatcher("/logout"));*/ //或者 http.logout().defaultLogoutSuccessHandlerFor(logoutSuccessHandler,new AntPathRequestMatcher("/logout")) // 退出成功之前操作 .addLogoutHandler(logoutHandler); ~~~