spring事务的怪问题
现在我在配置文件里添加了数据库类型的事务,并且添加了一个拦截器,具体程序如下:
<bean id="transactionManager"
/>
</property>
</bean>
<bean id="transactionInterceptor"
ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<value>*Bo</value>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
</bean>
然后写了个junit测试用例,
public void testSvcCallRMBySPS() throws Exception {
//资源订单同步文件头,暂时注释掉--start
File fileName = new File("D://测试数据//181101071130S1103783_1.xml");
SoSyncRequestDocument soDoc = SoSyncRequestDocument.Factory.parse(fileName);
String s= null;
try{
spsInterfaceSvrBo = (ISpsInterfaceSvrBo) ContextFactory.getBeanFactory().getBean("spsInterfaceSvrBo");
s = spsInterfaceSvrBo.svcCallRMBySPS("soSyncRequest", soDoc.toString());
System.out.println("@@@@@@@@@@@@@2222222222");
}catch(Exception ex){
System.out.println("ttttt2222222222");
ex.printStackTrace();
}
System.out.println("gggggg2222222222");
System.out.println(s);
}
问题出现了,在执行完spsInterfaceBo.svcCallRMBySPS("soSyncRequest",soDoc.toString())中的每一条语句之后,程序就死掉了,连接也死在那里了,因为这个时候开始执行hibernate的延迟加载。 如果说是什么关联的原因导致延迟加载错误,也应该出现异常,我对异常都用RunTimeException进行捕获并打印堆栈,现在不知道为何捕捉不到任何异常。 我的log的显示级别是info的。
为什么不显示异常呢?我是用这个测试用例调用本地的bo,然后在本地的bo中操作数据库,难道这样就不行吗?我有个同事也遇到这个问题,他没有管这个问题,但是我想问为什么?
不知道上面的描述具体吗?大家在答疑的过程中有什么疑惑,请给我回帖,我再贴上去!