版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/baijunzhijiang_01/article/details/51248265
在SpringMVC 配合Mybatis的使用中出现这样一个警告
[org.springframework.beans.factory.support.DisposableBeanAdapter (line-337)] - Invocation of destroy method ‘close’ failed on bean with name ‘sqlSession’: java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
解决办法:在Spring MVC的配置文件中加入
<bean id="writableSQLSession" class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">
<constructor-arg index="0" ref="sqlSessionFactory"/>
</bean>
重点是加上scope