Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » [Equinox Weaving] @Aspect ignored
[Equinox Weaving] @Aspect ignored [message #634749] Sat, 23 October 2010 00:28 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Got Equinox Weaving set up and it works in part (-Dorg.aspectj.weaver.showWeaveInfo=true and some testing shows that the Spring AnnotationTransactionAspect is applied). But it ignores a custom aspect I created. Any idea what I am doing wrong?

META-INF/aop.xml

<aspectj>    
    <weaver>
	    <include within="*"/>
    </weaver>
    <aspects>
        <include within="org.springframework.transaction.aspectj.AnnotationTransactionAspect"/>
        <include within="test.TimedAdvice"/>
    </aspects>
</aspectj>


test/TimedAdvice.java (in the same bundle):

package test;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Aspect
public class TimedAdvice {

    private final Logger log = LoggerFactory.getLogger(getClass());

    @Around("@annotation(org.springframework.transaction.annotation.Transactional)")
    public void execute(ProceedingJoinPoint point) throws Throwable {
        long t0 = System.currentTimeMillis();
        point.proceed();
        long duration = System.currentTimeMillis() - t0;
        log.debug("Duration: {}", duration);
    }
}

Re: [Equinox Weaving] @Aspect ignored [message #634751 is a reply to message #634749] Sat, 23 October 2010 01:03 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Turns out I need to reference the custom aspect like so:

<aspect name="test.TimedAdvice"/>


But now I get this error:

Quote:
error at test\TimedAdvice.java::0 Type referred to is not an annotation type: org$springframework$transaction$annotation$Transactional


Strange, because the org.springframework.transaction.annotation package is imported into the bundle. Any ideas?
Re: [Equinox Weaving] @Aspect ignored [message #637395 is a reply to message #634751] Fri, 05 November 2010 11:15 Go to previous messageGo to next message
Martin Lippert is currently offline Martin LippertFriend
Messages: 124
Registered: July 2009
Senior Member
Did you compile the project/bundle with AJDT?


On 23.10.10 03:03, Eric Jain wrote:
> Turns out I need to reference the custom aspect like so:
>
> <aspect name="test.TimedAdvice"/>
>
> But now I get this error:
>
> Quote:
>> error at test\TimedAdvice.java::0 Type referred to is not an
>> annotation type: org$springframework$transaction$annotation$Transactional
>
>
> Strange, because the org.springframework.transaction.annotation package
> is imported into the bundle. Any ideas?
>
Re: [Equinox Weaving] @Aspect ignored [message #637473 is a reply to message #637395] Fri, 05 November 2010 17:15 Go to previous message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Martin Lippert wrote on Fri, 05 November 2010 07:15
Did you compile the project/bundle with AJDT?


No; didn't realize I have to since I'm using load time weaving and annotations to define the aspects?
Previous Topic:EventAdmin best practices
Next Topic:P2 Update and Equinox Configuration Admin
Goto Forum:
  


Current Time: Tue Apr 23 15:35:41 GMT 2024

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

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

Back to the top