【发布时间】:2019-11-08 02:20:01
【问题描述】:
【问题讨论】:
标签: java spring multithreading session
【问题讨论】:
标签: java spring multithreading session
遇到了同样的问题,遇到了:https://bekce.github.io/replacing-session-scope-with-thread-scope-in-spring-framework/
“当您的应用程序还需要 Web servlet 以外的其他集成点时,会话范围的 bean 会出现问题”。
然后我使用了来自 sping 的 SimpleThredScope. 的自定义范围 = "thread"
在 bean 配置中,如下所示:
<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
<property name="scopes">
<map>
<entry key="thread">
<bean class="org.springframework.context.support.SimpleThreadScope"/>
</entry>
</map>
</property>
</bean>
<bean id="testA" class="com.concretepage.A" scope="thread" />
【讨论】: