-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Andrei Stefan opened SPR-3556 and commented
I made two tests:
- one with AspectJ support;
- one with Spring's AspectJ support.
The tests involve two interfaces: Base<T> and DerivedInterface<T> extends Base<T>.
A Before pointcut matching all methods from Base and DerivedInterface is defined: @Before
("execution(* example.Base+.*(..))")
In AspectJ a test creating an instance of a class implementing DerivedInterface: DerivedInterface<String> obj = new DerivedString(); and then calling methods on both interfaces demonstrates advice being applied on both methods.
The same test in Spring getting a bean instance from ApplicationContext like DerivedInterface<String> bean = (DerivedInterface<String>) context.getBean("myBean"); and calling methods on both interfaces, the advice is not applied to methods receiving as parameter the generic type <T>.
Methods like method(<T>) don't get the advice applied, but method2() have the advice applied.
Affects: 2.0.5, 2.1 M3
Attachments:
- SpringAspectJ.zip (1.86 kB)
Issue Links:
- Spring AOP @Aspect pointcut ignores generic type params and matches to many join points [SPR-3628] #8309 Spring AOP
@Aspect
pointcut ignores generic type params and matches to many join points ("is depended on by") - AspectJ pointcut expressions fail to match generically parameterized methods [SPR-3879] #8559 AspectJ pointcut expressions fail to match generically parameterized methods ("is duplicated by")