Shr*_*ari 52 java spring spring-mvc spring-ioc
Spring框架中session和globalSession有什么区别?
<bean id="exampleBean" class="com.test.baen.ExampleBean" scope="session"/>
<bean id="exampleBean" class="com.test.baen.ExampleBean" scope="globalSession"/>
Run Code Online (Sandbox Code Playgroud)
根据我的研究,两者在Web感知Spring ApplicationContext的上下文中都是有效的.
现在,会话bean作用域将一直保留到用户会话,但是globalSession bean作用域在整个应用程序中是否可用?
是申请范围吗?
我无法理解术语"全局HTTP会话"; 它将在整个全球HTTP会话中可用吗?
par*_*lov 106
globalSession
是与Portlet应用程序相关的东西.当您的应用程序在Portlet容器中工作时,它由一些portlet构建.每个portlet都有自己的会话,但是如果你想为应用程序中的所有portlet存储全局变量而不是存储它们globalSession
.此范围与session
基于Servlet的应用程序中的范围没有任何特殊效果.
小智 12
根据Spring文档::
session - 将单个bean定义范围限定为HTTP会话的生命周期.仅在Web感知Spring ApplicationContext的上下文中有效.
全局会话 - 将单个bean定义范围限定为全局HTTP会话的生命周期.通常仅在portlet上下文中使用时有效.仅在Web感知Spring ApplicationContext的上下文中有效.
归档时间: |
|
查看次数: |
39331 次 |
最近记录: |