I've got a transactional service class:
@Service
@Transactional(...)
public class MyService() {
public void myFunc() {
// some code
}
}
Also the following Aspect:
@Aspect
public class MyAspect() {
@AfterReturning(value = "execution(...") // pointcut matching myFunc()'s signature
public void doSomethingAfterMyFunc() {
// some code
}
}
The problem I'm facing is that upon entering the @AfterReturning advice, the transaction created from the execution of myFunc() 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 myFunc()'s transaction before entering the advice?
Thanks in advance!