Skip to main content

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

Is your annotation in a package by any chance?  In annotation style
pointcuts (@Pointcut) you need to fully qualify type names.  I only
say this because your pointcut looks OK.

Are you using SpringAOP to wire it up right now or just testing by
having it all in an AspectJ project? (Under AJDT in eclipse)

Andy

On 21 March 2011 03:14, jelramzy <jelramzy@xxxxxxxxx> wrote:
> 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.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top