项目测试环境使用的是springboot框架,配置了PerformanceInterceptor输出的sql语句比较直观,遂想在非boot的老项目也配置PerformanceInterceptor,
<bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean">
<!-- <property name="dataSource" ref="multipleDataSource"/>-->
<property name="dataSource" ref="dataSource"/>
<!-- 自动扫描Mapping.xml文件 -->
<property name="mapperLocations" value="classpath*:com/syc/mapping/*.xml"/>
<property name="configLocation" value="classpath:mybatis/mybatis-config.xml"/>
<property name="plugins">
<array>
<!-- 分页插件配置 -->
<bean id="paginationInterceptor" class="com.baomidou.mybatisplus.plugins.PaginationInterceptor">
<property name="localPage" value="true" />
</bean>
<bean id="performanceInterceptor" class="com.baomidou.mybatisplus.plugins.PerformanceInterceptor">
</bean>
</array>
</property>
<!-- 全局配置注入 -->
<!--<property name="globalConfig" ref="globalConfig" />-->
</bean>
效果:
2022-05-17 11:16:38,419 com.taobao.tomcat.container.context.pandora.PandoraManager startInternal
INFO: Pandora container started.
2022-05-17 11:16:38,499 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Software\EDAS\taobao-tomcat-7.0.59\webapps\manager has finished in 1,447 ms
11:18:11.633 [HSF-Worker-2-thread-1] DEBUG io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.default: 262144
11:18:11.635 [HSF-Worker-2-thread-1] DEBUG io.netty.util.internal.Cleaner0 - java.nio.ByteBuffer.cleaner(): available
DEBUG 2022-05-17 11:18:11[HSFBizProcessor-5-thread-1] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:159): ==> Preparing: DELETE FROM ck_goods WHERE (g_name = ?)
DEBUG 2022-05-17 11:18:12[HSFBizProcessor-5-thread-1] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:159): ==> Parameters: null
DEBUG 2022-05-17 11:18:12[HSFBizProcessor-5-thread-1] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:159): <== Updates: 0
888
Time:5 ms - ID:com.syc.dao.GoodsMapper.delete
Execute SQL:DELETE FROM ck_goods WHERE (g_name = null)