SpringMVC配置mybatisplus的PerformanceInterceptor插件

项目测试环境使用的是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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值