In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article was first published on the official account https://mp.weixin.qq.com/s/KCOFv0nRuymkX79-RZi9eg of Wechat, the Internet technology of vivo.
Author: Zhang Zhenglin
The HTTP protocol itself is stateless. In order to save the session information, the browser Cookie identifies the session request through SessionID, and the server stores the session information with SessionID as key. In single-instance applications, the storage of the application process itself can be considered. With the growth of the application volume, it is necessary to expand horizontally, and the problem of multi-instance session sharing follows.
Spring Session is to solve the problem of multi-process session sharing. This article will introduce how to use Spring Session and how Spring Session works.
1. Introduce the background
When the application is deployed in Tomcat, the session is maintained by Tomcat memory. If the application deploys multiple instances, the session cannot be shared. Spring Session is to solve the problem of session sharing in distributed scenarios.
2. Usage
Spring Session supports storage in Hazelcast, Redis, MongoDB, and relational databases. This article mainly discusses the storage of session in Redis.
Web.xml configuration:
SpringSessionRepositoryFilter org.springframework.web.filter.DelegatingFilterProxy springSessionRepositoryFilter / *
The main configuration of Spring:
PRV poolConfigRfex = "jedisPoolConfig" 3, workflow
Tomcat web.xml parsing steps:
ContextInitialized (ServletContextEvent arg0); / / Listenerinit (FilterConfig filterConfig); / / Filterinit (ServletConfig config); / / Servlet
Initialization order: Listener > Filter > Servlet.
1) load SessionRepositoryFilter into the Spring container through Tomcat's listener.
RedisHttpSessionConfiguration was declared in the Spring configuration file in the previous section, and SessionRepositoryFilter was generated in its parent class SpringHttpSessionConfiguration:
@ Beanpublic SessionRepositoryFilter
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.