Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Problems to set up an annotation based pointcut with Spring3 and Aspectj 1.6

Hi All,

well i am experiencing real troubles to test an AspectJ annotated poincut to
work on Spring 3.
The goal is to create a poincut that deals with methods annotated with a
given customized annotation.

Here is the annotation (simple one really)


@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
    String name();
}

Here is my Aspect @Aspect

@Aspect
public class MyPoinCut {

@Pointcut(value = "execution (@MyAnnotation  * *.*(..))")
    public void anyTaskToPerform() {
        /*  do domething */
}


@Around("anyTaskToPerform()")
    public Object performCallWhenException(ProceedingJoinPoint joinPoint)
throws Throwable {
        /* do something here too */
}}

Now, here is my main class including the annotation in its methods:


public class SomeJob {
 
  @MyAnnotation
  public letsdoit(){
  /* business */
  }

}

Ii have just a unit test calling the letsdoit method of the SomeJob class,
nothing special!

The problem is that it seems that the expression given to the poincut seem
to be wrong and i don't know how to fix it , thus,  my pointcut is just
ignored and never called !!

can i have some help please?

Thanks 

--
View this message in context: http://aspectj.2085585.n4.nabble.com/Problems-to-set-up-an-annotation-based-pointcut-with-Spring3-and-Aspectj-1-6-tp3393103p3393103.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top