怎么把一个class[]传入 class...的形参中
```Method realMethod = joinPoint.getTarget().getClass().getDeclaredMethod(getMethodName(joinPoint),((MethodSignature)joinPoint.getSignature()).getMethod().getParameterTypes());
怎么把一个class[]传入 class...的形参中
```Method realMethod = joinPoint.getTarget().getClass().getDeclaredMethod(getMethodName(joinPoint),((MethodSignature)joinPoint.getSignature()).getMethod().getParameterTypes());
以下是AOP的一个demo,你参考下,是不是你想要的
@Around("logPointCut()&& @annotation(sysLog)") //FIXME 这里反射到的类
public Object doAround(ProceedingJoinPoint point, SysLog sysLog) throws Throwable
{
long startTime = System.currentTimeMillis();
Object ob = point.proceed();
String requestUrl = sysLog.value();
// 拦截的类名
Class clazz = point.getTarget().getClass();
Signature sig = point.getSignature();
MethodSignature msig = null;
if (!(sig instanceof MethodSignature))
{
throw new IllegalArgumentException("该注解只能用于方法");
}
msig = (MethodSignature) sig;
Object target = point.getTarget();
Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes());
System.out.println("执行了类:" + clazz.getSimpleName());
System.out.println("方法:" + currentMethod.getName());
System.out.println("自定义注解:" + requestUrl);
//TODO 这里插入了日志
Logs log = new Logs();
logsService.insert(log);
LOG.info("耗时 : " + (System.currentTimeMillis() - startTime));
return ob;
}