运行环境
jdk版本:jdk1.8.0_202
springboot版本:2.2.0
mysql版本:5.6.31
代码实现
1、在application.properties中添加如下配置,即可在控制台打印sql语句
# 打印 SQL 日志
mybatis.configuration.log-impl = org.apache.ibatis.logging.stdout.StdOutImpl
2、控制台输出效果
源码地址:
https://gitee.com/jiefu813/jf-springboot/tree/jf_tkMybatis/