mybatis在控制台打印sql语句

1:mybatis-config.xml中配置:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <!-- 打印查询语句 -->
        <setting name="logImpl" value="STDOUT_LOGGING" />
    </settings>
</configuration>

2:spring-mvc中配置:

  <property name="configLocation" value="classpath:mybatis-config.xml"></property> 

猜你喜欢

转载自www.cnblogs.com/dw3306/p/9280071.html