简体   繁体   English

如何在Spring MVC中管理用户会话

[英]How to manage user session in Spring MVC

I am migrating java struts 1.1 application to Spring MVC. 我正在将java struts 1.1应用程序迁移到Spring MVC。 I have a question about how to handle user session, multiple users concurrently can log in and use this application. 我有一个有关如何处理用户会话的问题,多个用户可以同时登录并使用此应用程序。 Which is normal for any application. 这对于任何应用程序都是正常的。 Do I need to take care of anything specifically to manage user sessions just to make sure one user's activity should not be updating other user's activity/data. 我是否需要特别注意管理用户会话的所有事情,以确保一个用户的活动不应该更新其他用户的活动/数据。 I will be using the bean scopes as it is in spring mvc style. 我将使用spring mvc风格的bean作用域。

Any suggestions on this please? 有什么建议吗?

Kiran 基兰

Spring MVC just like Struts are based on Servlets and need to handle user session the same way. 就像Struts一样,Spring MVC也基于Servlet,并且需要以相同的方式处理用户会话。 You can access HttpSession in Spring Controller using RequestContextHolder or just declare it as parameter in your controller method. 您可以使用在Spring控制器访问HttpSession中RequestContextHolder或刚刚宣布它作为你的控制器方法的参数。

You use HandlerInterceptorAdapter and Spring Security Session management. 您使用HandlerInterceptorAdapter和Spring Security Session管理。 HTTP Session management is very important. HTTP会话管理非常重要。 Spring already provided. 春天已经提供。

HandlerInterceptorAdapter HandlerInterceptorAdapter

Spring Security Session management 春季安全会议管理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM