title: Spring: How to commit transaction before entering @AfterReturning advice
body: <p>I've got a transactional service class:</p>
  
  <pre><code>@Service
  @Transactional(...)
  public class MyService() {
  
      public void myFunc() { 
         // some code
      }
  
  }
  </code></pre>
  
  <p>Also the following Aspect:</p>
  
  <pre><code>@Aspect
  public class MyAspect() {
  
      @AfterReturning(value = "execution(...") // pointcut matching myFunc()'s signature
      public void doSomethingAfterMyFunc() { 
         // some code
      }
  
  }
  </code></pre>
  
  <p>The problem I'm facing is that upon entering the <code>@AfterReturning</code> advice, the transaction created from the execution of <code>myFunc()</code> is not yet committed, so the advice shares the same transaction. From what I've read this behavior is to be expected, but for my purposes I need the opposite - is there a way to commit <code>myFunc()</code>'s transaction before entering the advice?</p>
  
  <p>Thanks in advance!</p>