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层的代码就没有发现任何问题。