Does anybody know how to add a session destroy event in Spring Session with Redis?, I read that the normal way isn´t possible. I would like to do this because I need to do some cleaning process after a session is destroyed(timeout or logout). I would really appreciate your help, thanks in advance guys.
RedisOperationsSessionRepository
will publish org.springframework.session.events.SessionDestroyedEvent
(or to be more exact, its subclasses SessionDeletedEvent
and SessionExpiredEvent
) if it's configured with an ApplicationEventPublisher
. This will happen automatically if you're using @EnableRedisHttpSession
configuration support.
These events will then in turn be translated into javax.servlet.http.HttpSessionEvent
and then forwarded to all HttpSessionListener
s, assuming they are registered with your application context as beans.
For more details refer to HttpSessionListener section of Spring Session's reference manual.