Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnnotationTransactionAspect weaves to all public methods in CGLIB proxy include toString, hashCode etc. [SPR-17236] #21769

spring-projects-issues opened this issue Sep 3, 2018 · 0 comments
in: core in: data status: waiting-for-triage


Copy link

@spring-projects-issues spring-projects-issues commented Sep 3, 2018

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:

@EnableLoadTimeWeaving(aspectjWeaving = EnableLoadTimeWeaving.AspectJWeaving.AUTODETECT)
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)

And in aop.xml:

<weaver options="-showWeaveInfo">
  1. When you start with VM options:

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

  1. When you start with VM options:

It won't run because need to specify a custom LoadTimeWeaver or start your Java virtual machine with Spring's agent.

  1. When you start with both VM options:

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:

@spring-projects-issues spring-projects-issues added type: bug status: waiting-for-triage in: data in: core and removed type: bug labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core in: data status: waiting-for-triage
None yet

No branches or pull requests

1 participant