/** * 注销用户 */ @Override public String logout(HttpServletRequest request, HttpServletResponse response) { //获得用户认证信息 Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if(authentication != null) { //注销 new SecurityContextLogoutHandler().logout(request, response, authentication); } return "redirect:/login?logout"; }