@Bean public HttpSessionEventPublisher httpSessionEventPublisher(){ returnnewHttpSessionEventPublisher(); }
默认被挤掉的用户再次访问时,会通过write输出一段话,下面这样:
1 2 3 4 5 6 7 8 9
@Override publicvoidonExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException { HttpServletResponseresponse= event.getResponse(); response.getWriter().print( "This session has been expired (possibly due to multiple concurrent " + "logins being attempted as the same user)."); response.flushBuffer(); }