Last active
July 15, 2019 16:25
-
-
Save joshkitt/a53aed64e97f51932e9cf163b90a3767 to your computer and use it in GitHub Desktop.
Java Session Listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import javax.servlet.http.HttpSessionEvent; | |
import javax.servlet.http.HttpSessionListener; | |
@Configuration | |
public class SessionConfiguration { | |
@Bean | |
public HttpSessionListener httpSessionListener() { | |
return new HttpSessionListener() { | |
@Override | |
public void sessionCreated(HttpSessionEvent se) { | |
System.out.println("Session Created with Session id: " + se.getSession().getId()); | |
} | |
@Override | |
public void sessionDestroyed(HttpSessionEvent se) { | |
System.out.println("Session Destroyed for Session id: " + se.getSession().getId()); | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment