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…”?的详细内容,更多请关注其它相关文章!