标签:ack time trace string signature start out rtti service
package com.jt.aop;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class RuntimeAOP {
	@Around("execution(* com.jt.service..*.*(..))")
	public Object around(ProceedingJoinPoint joinPoint) {
		Object obj=null;
		Long starttime=System.currentTimeMillis();
		try {
			obj=joinPoint.proceed();
		} catch (Throwable e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		}
		Long endtime=System.currentTimeMillis();
		Class<?> targetclass = joinPoint.getTarget().getClass();
		String methodName = joinPoint.getSignature().getName();
		
		System.out.println("目标的对象类型:"+targetclass);
		System.out.println("目标方法的名称:"+methodName);
		System.out.println("RuntimeAOP[] 执行时间:"+(endtime-starttime)+"毫秒");
		
		return obj;
	}
}
标签:ack time trace string signature start out rtti service
原文地址:https://www.cnblogs.com/lizhiwei666/p/12037273.html