You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Affects: At least 4.2.1 - 5.3.9, probably all versions.
A !target(class) pointcut doesn't behave as expected: It seems like the negation implementation is wrong.
From my testing x && !target(org.springframework.web.filter.GenericFilterBean) behaves like x || target(org.springframework.web.filter.GenericFilterBean) instead.
java.lang.NullPointerException: Cannot invoke "org.apache.commons.logging.Log.isDebugEnabled()" because "this.logger" is null
at org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:241)
That means a bean extending GenericFilterBean must've matched the pointcut and thus was proxied (GenericFilterBean implementations cannot be cglib proxied due to its implementation).
@Around("exrp && !target(another_expr)") correctly intercepts beans matching expr and not matching another_expr
But when one of GenericFilterBean subclass matches expr (for example OrderedRequestContextFilter), then this bean is wrapped in SpringCBLIB (OrderedRequestContextFilter$$SpringCBLIB), and its logger field is not initialized, which leads to NPE
Affects: At least 4.2.1 - 5.3.9, probably all versions.
A
!target(class)
pointcut doesn't behave as expected: It seems like the negation implementation is wrong.From my testing
x && !target(org.springframework.web.filter.GenericFilterBean)
behaves likex || target(org.springframework.web.filter.GenericFilterBean)
instead.I've created an example project https://github.com/F43nd1r/spring-aop-negation-issue-demo. Just try to run the application. You'll see a stacktrace like this:
That means a bean extending GenericFilterBean must've matched the pointcut and thus was proxied (GenericFilterBean implementations cannot be cglib proxied due to its implementation).
Note: This issue was also described in this stackoverflow post nearly six years ago https://stackoverflow.com/questions/33136530/target-negation-not-working-in-spring-aop.
The text was updated successfully, but these errors were encountered: