When setting up the LTW and my own transactional aspect, I came across the strange behavior of AnnotationTransactionAspect.
The test project is available on the github. Consists of SpringBootApplication, Service and Repository. On Service and Repository using annotations Transactional. Application settings consist of:
CGLIB proxy for Repository is created and AnnotationTransactionAspect weaves to all CGLIB proxy public methods, include toString, hashCode etc. And AnnotationTransactionAspect doesn't weave to MyServiceMethod
When you start with VM options:
-javaagent:src/lib/aspectjweaver-1.9.1.jar
It won't run because need to specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent.
AnnotationTransactionAspect weaves to MyServiceMethod, MyRepositoryMethod (like expected) and to all MyRepository CGLIB proxy methods (include second weaves to MyRepositoryMethod).
It seems like bad behavior AnnotationTransactionAspect or poor documentation for LTW and agents: spring-instrument, aspectjweaver.
Plyushchev Anton opened SPR-17236 and commented
When setting up the LTW and my own transactional aspect, I came across the strange behavior of AnnotationTransactionAspect.
The test project is available on the github. Consists of SpringBootApplication, Service and Repository. On Service and Repository using annotations Transactional. Application settings consist of:
And in aop.xml:
CGLIB proxy for Repository is created and AnnotationTransactionAspect weaves to all CGLIB proxy public methods, include toString, hashCode etc. And AnnotationTransactionAspect doesn't weave to MyServiceMethod
It won't run because need to specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent.
AnnotationTransactionAspect weaves to MyServiceMethod, MyRepositoryMethod (like expected) and to all MyRepository CGLIB proxy methods (include second weaves to MyRepositoryMethod).
It seems like bad behavior AnnotationTransactionAspect or poor documentation for LTW and agents: spring-instrument, aspectjweaver.
Affects: 5.0.8
Reference URL: https://github.com/tatatatitatata/test-AOP
The text was updated successfully, but these errors were encountered: