Is spring bean scope supported in an HttpSession object?
If the HttpSession object that you mentioned here is actually provided by spring-session (spring-session wraps the httpSession object in the original httpRequest), the response will be YES - indeed, the entire spring beans session is stored in the httpSession provided by spring-session as attributes.
Or even if the HttpSession object applies only to spring session bean coverage, aren't we making the session object heavy?
Not. The severity of httpSession is very dependent on the objects you insert. In addition, the beans session must be ephemeral. Last but not least, a session object in the microservices world is usually uploaded to a standalone store, such as Redis or HazelCast. Thus, it will not be considered "heavy" in terms of memory consumption.
How is this another form storing any bean directly in an HttpSession object (which makes the HttpSession object a heavy point of view)?
No difference whatsoever (assuming you are using spring change), since all spring beans sessions are stored in the httpSession file provided by spring-session as attributes.
source share