I am using few session scoped beans in the app context xml of my spring mvc app. I have seen invalidate()
method in HTTPSession
class which does the detaching thing. Do I need to call this method somewhere in my spring app also to free up the session from the session scoped beans when those beans are mo more in use? Or does Spring internally take care of this?
No, you don't need to call Session#invalidate()
for session scoped beans as DispatcherServlet
takes care of these things.
It use 'org.springframework.web.context.request.RequestAttributes#registerDestructionCallback callback list functionality to register all these scoped beans.