idea junit运行报错:java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession
报错具体:
10:42:15.178 [Thread-0] WARN o.s.b.f.s.DisposableBeanAdapter - Invocation of destroy method 'close' failed on bean with name 'ksexptSqlSessionTemplate' java.lang.UnsupportedOperationException: Manual close is not allowed over a Spring managed SqlSession at org.mybatis.spring.SqlSessionTemplate.close(SqlSessionTemplate.java:306) ~[mybatis-spring-1.2.0.jar:1.2.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79] at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:327) [spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) [spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:510) [spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:486) [spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:740) [spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:455) [spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090) [spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1064) [spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:980) [spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE] 10:42:15.179 [Thread-0] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy method 'close' on bean with name 'ksexpt_dataSource'
Process finished with exit code 0
我试过配置SqlSessionTemplate为:
以及直接注释掉SqlSessionTemplate,但是运行结果都没有变化
希望你们能够帮帮我= ^ = 谢谢!
项目创建的问题,在module里面创建的