spring集成mybatis后怎么在控制台打印sql语句
1、applicationContext.xml中的sqlSessionFactory下增加下述标红部分属性
<bean aa">sqlSessionFactory" class="">
<property name="dataSource" ref="testDataSource" />
<!-- 自动扫描entity目录, 省掉里的手工配置 -->
<property name="typeAliasesPackage" value=".*.entity" />
<property name="configLocation" value="classpath:"></property>
<!-- 显式指定Mapper文件位置 -->
<property name="mapperLocations" >
<array>
<value>classpath*:/mybatis/*</value>
<value>classpath*:/com/kingdaqi/respository/*</value>
</array>
</property>
</bean>
2、在根目录下新建文件,内容如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-////DTD Config 3.0//EN" "/dtd/mybatis-3-">
<configuration>
<settings>
<!-- 打印查询语句 -->
<setting name="logImpl" value="STDOUT_LOGGING" />
</settings>
</configuration>