Java spring HttpSessionListener
I wrote my own SessionExpireListener
that will be called when the session is deleted. All my sessions are stored in redis. So I am using annotation @EnableRedisSession(maxInactiveIntervalInSeconds = 10)
. When I start my server the sessionCreated(HttpSessionEvent event)
. After 10 seconds the session is removed from redis but no sessionDestroyed
event is raised.
@Component
public class SessionExpireListener implements HttpSessionListener {
private static final Logger LOG = LoggerFactory.getLogger(SessionExpireListener.class);
@Override
public void sessionDestroyed(HttpSessionEvent se) {
LOG.info("Session has been destroyed...");
}
@Override
public void sessionCreated(HttpSessionEvent se) {
// TODO Auto-generated method stub
LOG.info("Session has been created...");
}
}
The console does not display LOG. SessionDestroyed is never called.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: