'How intercept session get attribute?

I was trying to implement persistence for sessions. I want to basically store the session data in a db and currently I'm using HttpSessionAttributeListener to store value in db when a new session is created.

I want to know how to retrieve the session from database ie how do I override the getSession attribute to retrieve from database.



Solution 1:[1]

Try to pass a parameter of type HttpSession to your controller.

Then access it using :

session.getAttribut(atr)

And modify it using

session.setAttribut(atr,"value")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elikill58