-
Notifications
You must be signed in to change notification settings - Fork 4
spring aop 性能日志
survior edited this page May 29, 2018
·
1 revision
<aop:aspect ref="simpleProfiler">
<aop:pointcut id="profileCut"
expression="execution(* com.xx.yy.server.dao.mybatis.*.*(..))||execution(* com.xx.yy.server.service.impl.*.*(..))||execution(* com.xx.yy.server.service.remoteimpl.*.*(..))||execution(* com.xx.yy.server.manager.*.*(..))"/>
<aop:around pointcut-ref="profileCut"
method="profile"/>
</aop:aspect>
指向的java:
// 记录初始时间,用于 profile
long startTime = System.currentTimeMillis();
try {
return call.proceed();
} catch (Throwable t) {
throw t;
} finally {
//进行性能统计和日志打印,利用ThreadLocal.
}