I started using Equinox Weaving so I could get Spring's @Transactional annotations to function better (e.g. on objects not managed by Spring). This has been working great. Now I wanted to add my own advice like so:
test-bundle/META-INF/aop.xml
<aspectj>
<weaver>
<include within="*"/>
</weaver>
<aspects>
<include within="org.springframework.transaction.aspectj.AnnotationTransactionAspect"/>
<aspect name="test.ui.TestAdvice"/>
</aspects>
</aspectj>
test-bundle/src/test/ui/TestAdvice.java
package test.ui;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class TestAdvice {
@Around("execution(public void test.ui.Foo.bar())")
public void execute(ProceedingJoinPoint point) throws Throwable {
// do stuff
point.proceed();
// do more stuff
}
}
test-bundle/src/test/ui/Foo.java
package test.ui;
public class Foo {
public void bar() {
// whatever
}
}
Unfortunately the advice is never executed.
If I change the @Around annotation to refer to a bogus class (or even just to a class located in a different package than the advice class!) I get these warnings on startup:
[test-bundle-2] warning at test\ui\TestAdvice.java::0 no match for this type name: test.util.Bar [Xlint:invalidAbsoluteTypeName]
[test-bundle-3] warning at test\ui\TestAdvice.java::0 no match for this type name: test.util.Bar [Xlint:invalidAbsoluteTypeName]
test-bundle-2 and test-bundle-3 and separate bundles that are part of the same application but are supposed to be AOP-unaware.
What am I missing?