控制台日志信息:

was not registered for synchronization because synchronization is not active JDBC Connection。

Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@19e35973]

出现以上信息说明spring的事物被覆盖掉了,通常是因为在spring.xml中扫描了一次@service注解后,springmvc.xml又重新扫描@service的注解,把事物覆盖掉了。

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

解决办法:

<context:component-scan base-package="com.zsmonitor">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service"></context:exclude-filter>
</context:component-scan>

在springmvc.xml中不扫描@Service注解就可以了

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄