`

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上加上
scope="prototype"
最终结果如下:
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
		<constructor-arg ref="sqlSessionFactory" />
</bean>


备注:scope="prototype"慎用,你明白的!
分享到:
评论
2 楼 renyuan2ni 2015-06-19  
[i][b][u]
引用
[list]
[*][img][flash=200,200][*][*]
[align=left][/align]
[/flash][/img] [/list]
[/u][/b][/i] 
1 楼 zhijun814 2014-06-11  
使用spring+springjdbc+mybatis开发了??还是只是练手

相关推荐

Global site tag (gtag.js) - Google Analytics