title: Spring AOP: After vs AfterReturning precedence
body: <p>I've coded this code snippet:</p>
  
  <pre><code>@Aspect
  @Component
  public class ApiAuditAspect {
  
      @Pointcut(value = "execution(* net.gencat.transversal.espaidoc.api.controller.RepositoryController.*(..))")
      public void anyRepositoryController() {
          // Nothing to do here
      }
  
      @AfterReturning(
          pointcut = "anyRepositoryController()",
          returning = "result")
      public void audit(JoinPoint point, Object result) throws Throwable {
          // audit actions
      }
  
      @After("anyRepositoryController()")
      public void flush() {
          // flush all audits
      }
  
  }
  </code></pre>
  
  <p>I've realized <code>flush</code> is executed before <code>audit</code>.</p>
  
  <p>I though <code>@After</code> is executed after <code>AfterReturning</code>.</p>
  
  <p>Any ideas about how to solve that?</p>