接手了个springboot项目 ,在mybatisconfig文件中加入@EnableTransactionManagement ,然后在service -impl 中加入@Transactional 注解,然后进入service层时就报错 。
报错信息如下 :
Request processing failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.transaction.PlatformTransactionManager' available] with root cause
期间我试着将 @EnableTransactionManagement去掉,然后再重启,正常进入service方法,本来以为解决了。
在debug代码时发现@Transactional事务没起作用,继续找问题。
最后让我在application启动类中看到
注释掉就没问题,事务也正常执行回滚。
记录下这个错误,后面再慢慢看代码 找根源。