posted 13 years ago
Hi.
Does Spring 2.5 provide any possibility to listen for session events (as this is done by HttpSessionListener) in session-scoped bean ?
In my application users work with some kind of shared data. Thus, I need to lock some piece of this data based on user http session when this user is currently modifying it. I need some reliable way to release the lock as soon as the corresponding http session is invalidated (no matter whether on user's logout action or on session timeout).
The reason I don't wan't to use HttpSessionListener is simple - releasing the lock includes some actions invoked on spring beans. I don't wan't to hardcode bean names when getting those beans from my implementation of HttpSessionListener.
I tried using both destroy-method="" and implementing DisposableBean for my session scoped beans. But it seems that destroy method is used only for singleton beans when the container is shutdown.
So the question is: is there any way to notify my session-scoped bean on http session invalidation?