第一种方法(推荐)
在application.yml(.properties)中增加配置,在控制台打印sql:
mybatis:
mapper-locations:
- classpath:mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
第二种方法
通过日志级别控制SQL打印
logging:
level:
com.test.test.dao.mapper: DEBUG //包路径为mapper文件包路径