1 Reply Latest reply: May 16, 2011 3:05 AM by kumaran d RSS

    Negation Pointcut Example

    kumaran d Newbie

      Hi

       

      In Jboss AOP how we can exclude some packages not to be intercepted. Is negation( '!' Not Operator ) correct way of doing it ??.

      If so please advise me how to use it..

       

      In the below package structure i want to intercept all the classes except com.mycom.common.util package classes.

       

           com.mycom.common

           com.mycom.common.util

           com.mycom.common.dao

           com.mycom.common.entity

           com.mycom.common.service

       

                 <bind pointcut="execution(* com.mycom.common.*->*(..)) AND execution(* !com.mycom.common.util.*->*(..)) ">

                        <interceptor-ref name="com.mycom.aop.MyInterceptor"/>

                </bind>

       

      This expression throws an exception. please help me in resolving the issue.

        • 1. Negation Pointcut Example
          kumaran d Newbie

          finally i have resolved the issue as below.

           

           

              <bind pointcut="execution( * com.mycom.common.*->*(..) )

                      AND !execution( * com.mycom.common.util.*->*(..) ) ">

                  <interceptor-ref name="com.mycom.aop.MyInterceptor"/>

              </bind>

           

          thanks.