在 Spring-Session with Redis 添加会话销毁事件
Add session destroy event on Spring-Session with Redis
有人知道如何在 Spring Session with Redis 中添加会话销毁事件吗?我读到正常方法是不可能的。我想这样做是因为我需要在会话被销毁(超时或注销)后做一些清理过程。
非常感谢您的帮助,在此先感谢大家。
RedisOperationsSessionRepository
将发布 org.springframework.session.events.SessionDestroyedEvent
(或者更准确地说,它的子类 SessionDeletedEvent
和 SessionExpiredEvent
)如果配置了 ApplicationEventPublisher
。如果您使用 @EnableRedisHttpSession
配置支持,这将自动发生。
然后这些事件将依次转换为 javax.servlet.http.HttpSessionEvent
,然后转发给所有 HttpSessionListener
,假设它们已作为 beans 在您的应用程序上下文中注册。
有关详细信息,请参阅 HttpSessionListener
Spring 会话参考手册的第 部分。
有人知道如何在 Spring Session with Redis 中添加会话销毁事件吗?我读到正常方法是不可能的。我想这样做是因为我需要在会话被销毁(超时或注销)后做一些清理过程。 非常感谢您的帮助,在此先感谢大家。
RedisOperationsSessionRepository
将发布 org.springframework.session.events.SessionDestroyedEvent
(或者更准确地说,它的子类 SessionDeletedEvent
和 SessionExpiredEvent
)如果配置了 ApplicationEventPublisher
。如果您使用 @EnableRedisHttpSession
配置支持,这将自动发生。
然后这些事件将依次转换为 javax.servlet.http.HttpSessionEvent
,然后转发给所有 HttpSessionListener
,假设它们已作为 beans 在您的应用程序上下文中注册。
有关详细信息,请参阅 HttpSessionListener Spring 会话参考手册的第 部分。