如何在JavaSpring引导应用程序中跟踪用户的登录 5 小时,31 分钟 Questions & Answers 990 应用程序已经通过Spring会话配置为将用户会话记录到SQL数据库中。现在,我想将用户会话记录到我自己的数据库表中,以便跟踪用户登录数据。有哪些可能的方法可以做到这一点
# 1 楼答案 最初的海报可能已经从这个问题转移了,但其他人和我一样认为本教程很有用: Keep Track of Logged In Users with Spring Security 基本上,它利用HttpBindingSessionListener来跟踪当前登录用户的列表
# 2 楼答案 您可以为AuthenticationSuccessEvent或InteractiveAuthenticationSuccessEvent事件创建一个实现ApplicationListener<>的bean 有关更多信息,请参阅: http://www.baeldung.com/spring-events https://docs.spring.io/spring-boot/docs/2.0.x/reference/htmlsingle/#boot-features-application-events-and-listeners
# 1 楼答案
最初的海报可能已经从这个问题转移了,但其他人和我一样认为本教程很有用:
Keep Track of Logged In Users with Spring Security
基本上,它利用HttpBindingSessionListener来跟踪当前登录用户的列表
# 2 楼答案
您可以为
AuthenticationSuccessEvent
或InteractiveAuthenticationSuccessEvent
事件创建一个实现ApplicationListener<>
的bean有关更多信息,请参阅: