민서네집

Invocation of destroy method 'close' failed on bean with name 'sqlSessionTemplate' 본문

Spring

Invocation of destroy method 'close' failed on bean with name 'sqlSessionTemplate'

브라이언7 2014. 12. 23. 17:48

Invocation of destroy method 'close' failed on bean with name 'sqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession


다음과 같은 Warning 없애기.


2014-12-23 17:39:39,683  WARN {localhost-startStop-2} [org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod()] (DisposableBeanAdapter.java:360) - Invocation of destroy method 'close' failed on bean with name 'sqlSessionTemplate': java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession


내 개발환경: 

MyBatis - 3.2.7

Spring - 4.0.6.RELEASE


[출처] https://code.google.com/p/mybatis/issues/detail?id=778


아래와 같이 destroy-method="clearCache" 만 추가해주면 Tomcat 서버를 종료할 때 WARNING이 발생하지 않는다.


<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate" destroy-method="clearCache">

<constructor-arg ref="sqlSessionFactory" />

</bean>



Comments