Manual close is not allowed over a Spring managed SqlSession

时间:2015-07-12 21:49:11   收藏:0   阅读:2269

Manual close is not allowed over a Spring managed SqlSession

整合spring与MyBatis时出现如下警告: 
[org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:360)]-[WARN] Invocation of destroy method ‘close‘ failed on bean with name ‘sqlSession‘: java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession 
网上搜了一下,要去掉警告要在org.mybatis.spring.SqlSessionTemplate上加上 
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">  

       <constructor-arg ref="sqlSessionFactory" />  

</bean>  


原文:http://xuchenguang.blog.51cto.com/730272/1673434

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!