Spring bean scopes: session and globalSession

前端 未结 2 1818
迷失自我
迷失自我 2021-01-30 16:06

What is the difference between session and globalSession in Spring framework?



        
相关标签:
2条回答
  • 2021-01-30 16:38

    As per Spring documentation ::

    session - Scopes a single bean definition to the lifecycle of an HTTP Session. Only valid in the context of a web-aware Spring ApplicationContext.

    global session - Scopes a single bean definition to the lifecycle of a global HTTP Session. Typically only valid when used in a portlet context. Only valid in the context of a web-aware Spring ApplicationContext.

    0 讨论(0)
  • 2021-01-30 16:39

    globalSession is something which is connected to Portlet applications. When your application works in Portlet container it is built of some amount of portlets. Each portlet has its own session, but if your want to store variables global for all portlets in your application than you should store them in globalSession. This scope doesn't have any special effect different from session scope in Servlet based applications.

    0 讨论(0)
提交回复
热议问题