Results 1 to 3 of 3

Thread: Declare pointcut for a package and all its sub-packages

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    28

    Default Declare pointcut for a package and all its sub-packages

    Hi

    My service classes are created in the following packages:
    com.myapp.service.base
    com.myapp.serivce.base.security
    com.myapp.serivce.base.file


    and currently I have to declare the pointcut like the following,
    Code:
      <aop:config>
        <aop:pointcut id="serviceMethods" expression="execution(* com.myapp.service.*.*(..)) || execution(* com.myapp.service.*.*.*(..))" />
        <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethods" />
      </aop:config>
    How can simply this?

    Is there any way I can declare the pointcut in one simple expression to include all the sub-packages? without having to include it one by one using the "||"?

    Please help, thank you!

  2. #2
    Join Date
    Jun 2008
    Location
    Zaandam, The Netherlands
    Posts
    26

    Default

    You could use the following expression to define a pointcut on all methods of all classes in all subpackages of com.myapp.service:

    execution(* com.myapp.service..*(..))

  3. #3

    Default

    not working...

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
  •