Results 1 to 3 of 3

Thread: @Around annotation

  1. #1

    Default @Around annotation

    Hi all,
    We are having a slight issue getting the @AspectJ annotations to work on an around advice.

    We have done a search, but fail to find any explantion of the annotation syntax, so were hoping you guys would help.

    We have a class A.
    A has several methods all of which we wish to put @Around advice on, so that we can change the exception that is being thrown.

    Here is an example of the @AspectJ class we are using:

    Code:
    .....
    @Around("Execution(* com.myclasses..*Dao(..))"
    public Object aMethod(ProceedingJoinPoint pjp){
    }
    We are happy with the actual advice, but we dont understand the syntax of the annotation:

    What does the first * represent, is it the return type?
    Is the .*Dao acceptable?
    what is the meaning of the (..)?

    Thanks
    G

  2. #2
    Join Date
    Jun 2006
    Location
    SF Bay Area, California
    Posts
    524

    Default

    You should read Spring and AspectJ reference guide.

    In your case:
    - The first * means any return type.
    - The first .. means any level of packages (i.e. direct and indirect subpackages of com.myclasses)
    - The last .. means any number and type of arguments.

    -Ramnivas
    Ramnivas Laddad (Follow me on Twitter)
    AspectJ in Action: Enterprise AOP with Spring Applications (2nd edition). Now available!

  3. #3

    Default

    Thanks for the that.

    Gavin

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •