Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ServiceInterceptor.java 550B

1234567891011121314151617
  1. import org.aspectj.lang.ProceedingJoinPoint;
  2. import org.aspectj.lang.annotation.Around;
  3. import org.aspectj.lang.annotation.Aspect;
  4. @Aspect
  5. public class ServiceInterceptor {
  6. @Around("execution(void test.Service.method(long))")
  7. public void method(ProceedingJoinPoint pjp) throws Throwable {
  8. Object[] args = pjp.getArgs();
  9. long id = (Long) args[0];
  10. System.out.println("in advice, arg = " + id + " (before proceed)");
  11. pjp.proceed(pjp.getArgs());
  12. System.out.println("in advice (after proceed)");
  13. }
  14. }