用到ContextLoaderPlugIn没有?在struts-config.xml中定义的ContextLoaderPlugIn应只载入struts action bean的spring配置文件。在web.xml中的ContextLoaderServlet则载入其它的spring配置文件其原因是ContextLoaderPlugIn和ContextLoaderServlet会以不同的key去存放各自实例化的WebXmlApplicationContext,但OpenSessionInViewFilter取得是ContextLoaderServlet实例化的。
我把所有的 action 都独立出来放在 applicationContext_action.xml
里面了而在 web.xml 里面也只配置了 applicationContext.xml
在struts.action.advinfo.PostAction中的infoClassesDAO并没有进行事务管理
<property name="infoClassesDAO">
<ref bean="InfoClassesDAO" /> ====>> 改为DAOProxy再试试
</property>通过代理调用dao,spring才会给你管理事务
错误:
org.springframework.beans.factory.FactoryBeanNotInitializedException: Error creating bean with name 'DAOProxy': FactoryBean returned null object: probably not fully initialized (maybe due to circular bean reference)
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref local="transactionManager" />
</property>
<property name="target">
<list> ==> 删掉
<ref local="InfoClassesDAO" />
</list> ==> 删掉
</property>.....
</bean>
FlushMode.NEVER没有变成 FlushMode.AUTO