String4版本 在biz层做多线程处理集合任务报错:
Could not obtain transaction-synchronized Session for current thread
这种错误暂时没有发现是什么原因,按照网上的配置方法改wms.xml或者在方法加@Transactional都不行
今天不甘心,把代码移动到非biz层去做就没问题了。
Spring配置:
<!-- 配置事务切面 -->
<aop:config>
<aop:pointcut id="serviceOperation"
expression="execution(* com.oa..biz.*.*(..))" />
<aop:advisor advice-ref="txAdvice"
pointcut-ref="serviceOperation" />
</aop:config>
<!-- 自动加载构建bean -->
<context:component-scan base-package="com.oa" />
<task:annotation-driven />
我是在job里面做定时任务的,把处理的多线程逻辑就放到job那里,然后取调用biz层的代码就没有发现任何问题。
在使用Spring框架进行多线程处理时,在biz层遇到Couldnotobtaintransaction-synchronizedSessionforcurrentthread错误。尝试多种解决办法无效后,将多线程逻辑移至非biz层,问题得以解决。
433

被折叠的 条评论
为什么被折叠?



