using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { St
架构:SSH框架 问题:多线程下的持久化操作 异常No Session found for current thread出现环境: SSH框架,采用声明式事务, 通过sessionFactory.getCurrentSession() 获取SESSION, 因为SPRING绑定事务到线程上,所以当new Thread()线程中去执行持久化操作时,就会产生异常No Session found for current thread 解决方法: 通过 实现ApplicationContextAware