SpringBoot项目运行报错:SqlSession注册失败,如何解决“Creating a new SqlSession… was not registered for synchronization…”?
编程并不是一个机械性的工作,而是需要有思考,有创新的工作,语法是固定的,但解决问题的思路则是依靠人的思维,这就需要我们坚持学习和更新自己的知识。今天就整理分享《SpringBoot项目运行报错:SqlSession注册失败,如何解决“Creating a new SqlSession… was not registered for synchronization…”? 》,文章讲解的知识点主要包括,如果你对文章方面的知识点感兴趣,就不要错过,在这可以对大家的知识积累有所帮助,助力开发能力的提升。
springboot项目运行报错:sqlsession注册失败
您的springboot项目在未修改任何代码的情况下突然出现 “creating a new sqlsession… was not registered for synchronization…” 的错误,令人困惑不解。具体报错如下:
creating a new sqlsession sqlsession [org.apache.ibatis.session.defaults.defaultsqlsession@2dbe837b] was not registered for synchronization because synchronization is not active
检查了配置文件,发现如下内容:
server: port: 8080 spring: datasource: druid: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://110.35.20.7:3306/cos?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai username: mes_it password: 123456 mybatis-plus: config-location: classpath:mybatis/mybatis-config.xml mapper-locations: classpath:mybatis/mapper/*.xml
然而,这似乎没有什么问题。
解决方法:
为了解决此问题,可以参考以下解决方案:
- [mybatis-plus报错:creating a new sqlsession… was not registered for synchronization because synchronization is not active – csdn博客](https://blog.csdn.net/web1829…)
该链接提供了详细的分析和解决方案,值得一试。
以上就是《SpringBoot项目运行报错:SqlSession注册失败,如何解决“Creating a new SqlSession… was not registered for synchronization…”? 》的详细内容,更多关于的资料请关注公众号!