Spring Session作用域bean是否保存在HttpSession中? [英] Is Spring session scoped bean saved in HttpSession?

查看:103
本文介绍了Spring Session作用域bean是否保存在HttpSession中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我对Spring Session范围的实现没有深入的了解. 谁能告诉我使用Spring Session范围内的Bean是否明智,因为HttpSession对象非常重要.就像Web应用程序一样,成千上万的用户可以同时访问该网站.

Since I don't have in depth knowledge of spring session scope implementation. Can anyone please tell me if it is wise to use Spring Session scoped beans, where HttpSession object is very crucial. Like a web application where thousands of users access the site simultaneously.

spring会话作用域中的bean是否保存在HttpSession对象中?

Is spring session scoped bean saved in HttpSession object?

或者即使HttpSession对象仅引用Spring会话作用域的bean,我们是否也不会增加会话对象的负担?

Or even if HttpSession object only refers to the spring session scoped bean, are we not making session object heavy?

直接在HttpSession对象中存储任何bean(使HttpSession对象的观点繁重)有何不同形式?

How is it different form storing any bean directly in HttpSession object (making HttpSession object heavy point of view)?

推荐答案

对象未真正存储在HTTP会话中.它与会话ID链接,并实际上存储在Spring上下文内部.会话监听器用于在会话关闭后清除实例.参见 SessionScope JavaDoc.

The object is not really stored in HTTP session. It is linked with session id and actually stored inside of the Spring context. A session listener is used to clean instances once session is closed. See SessionScope JavaDoc.

这篇关于Spring Session作用域bean是否保存在HttpSession中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆