问题:
/**
* 给注解了 @InvokeLog 的函数增加输入参数、返回数据、执行时间
* @author 唐芳华 <fanghua.tang@daydaycook.com>
*/
@Component
@Aspect
public class InvokeLogAspect {
private static final Logger LOG = Logger.getLogger(InvokeLogAspect.class.getName());
@Around(“@annotation(com.common.log.InvokeLog)”)
public Object log(ProceedingJoinPoint joinPoint) throws Throwable {
long startMS = System.currentTimeMillis();
Object ret = joinPoint.proceed();
long endMS = System.currentTimeMillis();
LOG.log(Level.INFO, “{3}\tparams: [{0}] \treturn:{1}\t span:{2}ms”, new Object[]{StringUtils.join(joinPoint.getArgs(), “,”), ret, endMS – startMS, joinPoint.getSignature().getName()});
return ret;
}
}
解决:
检查 <context:component-scan base-package=”****”/> 有没有包含此包
参考: