栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

当我使用ConcurrentSessionControlAuthenticationStrategy而不是ConcurrentSessionControlStrategy时,sessionRegist

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

当我使用ConcurrentSessionControlAuthenticationStrategy而不是ConcurrentSessionControlStrategy时,sessionRegist

我遇到了同样的问题,问题是由于web.xml中的错误配置,在spring上下文中加载了2个sessionRegistry实例,并且

sessionRegistry
控制器中引用的bean与spring-
security中引用的bean不同。

修复您的web.xml,确保

DispatcherServlet
不会再次加载根
contextConfigLocation
示例中存在的Bean
,dispatcherServlet只会加载具有spring mvc相关内容的servlet-context.xml,而root-
context.xml只会导入dao,service,安全配置bean ..

 <context-param>    <param-name>contextConfigLocation</param-name>    <param-value>        /WEB-INF/spring/root-context.xml    </param-value>  </context-param> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>    <init-param>      <param-name>contextConfigLocation</param-name>      <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>    </init-param>

更新:另一个要检查的问题是,如果您只有

ConcurrentSessionControlAuthenticationStrategy
,这不是注册会话,因此我们需要进行
RegisterSessionAuthenticationStrategy
如下操作

  <bean id="sas" >        <constructor-arg> <list>     <bean >         <constructor-arg ref="sessionRegistry"/>         <property name="maximumSessions" value="1" />         <property name="exceptionIfMaximumExceeded" value="true" />     </bean>     <bean >     </bean>     <bean >         <constructor-arg ref="sessionRegistry"/>     </bean> </list>         </constructor-arg>    </bean>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/495218.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号