Manual close is not allowed over a Spring managed SqlSession

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>  


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章