May 3rd, 2011, 03:32 PM
Schema based pointcut issues (Spring 3.0.5)
Encountering two issues:
1) if I put the word "not" at the beginning of a pointcut expression I get an error but the bang (!) works fine.
<aop:after-returning method="doSomething" pointcut="not target(com.Bar)"/>
<aop:after-returning method="doSomething" pointcut="!target(com.Bar)"/>
2) if i put a "not" (regardless of whether I use the bang or the word) in a pointcut sub-expression the entire expression fails to ever match.
<aop:after-returning method="doSomething" pointcut="target(com.Foo) and not target(com.Bar)"/>
I cannot use annotations to do this because the "doSomething" method is in a class that I do not have access to (in a utility jar).
What am I missing?
May 5th, 2011, 10:27 AM
I wanted to add, this problem appears for us (jaweitlauf and myself) to happen primarily when using target, @target, or @within in a compound statment with negation.
pointcut="target(some.Target) and bean(somebeanName)" works fine
pointcut="target(some.Target) and not bean(somebeanName)" will not work as expected
I think this issue is the same as: https://jira.springsource.org/browse/SPR-5439 and I have posted there as well. If anyone knows of a suitable work around or solution, please post it.
May 5th, 2011, 12:52 PM
I believe I have found a workaround. See below:
within(@the.type.Annotation *) and !bean(notwanted*)
This appears to do what I need without using target. There may be other issues, but I have not seen them yet.
Tags for this Thread