ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 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); ~~~