在 Spring 会话中禁用多会话支持
Disable multiple session support in Spring Session
我想在基于 xml 配置的项目中使用 Spring Session
,但不支持同一浏览器中的多个会话(用户登录)window。
可以禁用吗?如果是,如何?
根据CookieHttpSessionStrategy#setSessionAliasParamName
javadoc:
Sets the name of the HTTP parameter that is used to specify the
session alias. If the value is null, then only a single session is
supported per browser.
所以对于 Spring XML 配置,这转换为:
<bean class="org.springframework.session.web.http.CookieHttpSessionStrategy">
<property name="sessionAliasParamName">
<null/>
</property>
</bean>
我想在基于 xml 配置的项目中使用 Spring Session
,但不支持同一浏览器中的多个会话(用户登录)window。
可以禁用吗?如果是,如何?
根据CookieHttpSessionStrategy#setSessionAliasParamName
javadoc:
Sets the name of the HTTP parameter that is used to specify the session alias. If the value is null, then only a single session is supported per browser.
所以对于 Spring XML 配置,这转换为:
<bean class="org.springframework.session.web.http.CookieHttpSessionStrategy">
<property name="sessionAliasParamName">
<null/>
</property>
</bean>