Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Equinox Weaving with @Aspect
Equinox Weaving with @Aspect [message #638060] Tue, 09 November 2010 19:23
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
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?
Previous Topic:Inheriting from Template Class
Next Topic:New to AspectJ
Goto Forum:
  


Current Time: Thu Mar 28 20:36:25 GMT 2024

Powered by FUDForum. Page generated in 0.02227 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top