Announcement Announcement Module
Collapse
No announcement yet.
Declare pointcut for a package and all its sub-packages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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..*(..))

    Comment


    • #3
      not working...

      Comment

      Working...
      X