Open kklepacz opened 4 years ago
According to the configuration of your demo project, I think you are using Compile-Time Weaving
instead of LTW
. But Spring project's aspects do not have advice ordering
guaranteed( no precedence declaration in .aj file or precedence attribute in aop.xml).
Affects: 5.x.x
Since Spring 5 (spring-aspects 5.x.x), it looks like
@Transactional
is ignored on the method with@Async
when usingAdviceMode.ASPECTJ
for both@EnableTransactionManagement
and@EnableAsync
.Please take a look on following demo: https://github.com/kklepacz/spring-async-transaction-demo
After running
mvn clean test
you should see following output:So even if
@Transactional
annotation is present onhandle
method, transaction is not active.Now, let's change Spring version. Update pom to use Spring 4 + Spring Boot 1.5.x
Run
mvn clean test
again. Output:Transaction is active.
Is it a bug or a feature and I need some extra configuration to have my Spring Boot 2 version working as expected?
Is it related to AJC compilation anyhow? I can see a difference between an order of compilation in maven output. For Spring Aspects 5.x:
For Spring Aspects 4.x - order is different: