Spring AOP Pointcut syntax for AND, OR and NOT

Posted by ixlepixle on Stack Overflow See other posts from Stack Overflow or by ixlepixle
Published on 2010-02-15T15:15:26Z Indexed on 2010/03/26 11:33 UTC
Read the original article Hit count: 742

Filed under:
|
|

I'm having trouble with a pointcut definition in Spring (version 2.5.6). I'm trying to intercept all method calls to a class, except for a given method (someMethod in the example below).

<aop:config>
    <aop:advisor
         pointcut="execution(* x.y.z.ClassName.*(..)) AND NOT
                   execution(* x.y.x.ClassName.someMethod(..))"
    />
</aop:config>

However, the interceptor is invoked for someMethod as well.

Then I tried this:

<aop:config>
    <aop:advisor
         pointcut="execution(* x.y.z.ClassName.(* AND NOT someMethod)(..)) )"
    />
</aop:config>

But this does not compile as it is not valid syntax (I get a BeanCreationException).

Can anybody give any tips?

© Stack Overflow or respective owner

Related posts about spring

Related posts about spring-aop