Bonjour ,
Je tente désespéremment de faire fonctionner l'expression suivante avec AspectJ => @Around("execution(* *(..)) && @annotation(be.javainside.commons.annotations.Performance)")
Si j'enlève @annotation , bien évidemment cela fonctionne.
Etrangement , sous spring-aop , ca ne pose pas de problème.
Cordialemment.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 @Aspect public class Performance { private static org.slf4j.Logger LOGGER = LoggerFactory.getLogger(Performance.class); @Around("execution(* *(..)) && @annotation(be.javainside.commons.annotations.Performance)") public Object around(final ProceedingJoinPoint joinPoint) throws Throwable { Signature signature = joinPoint.getSignature(); if (!(signature instanceof MethodSignature)) { return joinPoint.proceed(); } String methodName = signature.toLongString(); long startTime = System.currentTimeMillis(); Object point = joinPoint.proceed(); long endTime = System.currentTimeMillis(); long executionTime = (endTime - startTime); if (LOGGER.isInfoEnabled()) { LOGGER.info("[ PERF ] ( " + (executionTime / 1000) + "." + (executionTime % 1000) + "s / " + executionTime + "ms ) " + methodName); } return point; } }
Partager