Spring Boot integrates MyBatis Plus to print SQL statements on the console

Foreword:

Under normal circumstances, MyBatis Plus will not print the executed SQL statement on the console, but when development encounters a BUG, ​​we often need to view the SQL statement on the console to diagnose the error.

Just add the following configuration to the Spring Boot yml file

mybatis-plus:
  configuration:
    # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

The effect is as follows

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44613100/article/details/107164556