springboot mybatis打印sql语句如何配置
在Spring Boot项目中使用MyBatis打印SQL语句有两种经常使用的配置方式:
<settings>
<setting name="logImpl" value="LOG4J2"/>
</settings>
这样就能够将SQL语句打印到日志中。
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
这样也能够将SQL语句打印到控制台中。
通过以上配置,可以在控制台或日志中看到MyBatis履行的SQL语句,方便调试和优化SQL。
TOP