Evaluate thread-bound MethodInvocation only if it matches current Method
Closes gh-26068
This commit is contained in:
parent
785598629a
commit
03b6e51225
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2023 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -334,13 +334,15 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
|
||||||
Object targetObject = null;
|
Object targetObject = null;
|
||||||
Object thisObject = null;
|
Object thisObject = null;
|
||||||
try {
|
try {
|
||||||
MethodInvocation mi = ExposeInvocationInterceptor.currentInvocation();
|
MethodInvocation curr = ExposeInvocationInterceptor.currentInvocation();
|
||||||
targetObject = mi.getThis();
|
if (curr.getMethod() == method) {
|
||||||
if (!(mi instanceof ProxyMethodInvocation _pmi)) {
|
targetObject = curr.getThis();
|
||||||
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + mi);
|
if (!(curr instanceof ProxyMethodInvocation currPmi)) {
|
||||||
|
throw new IllegalStateException("MethodInvocation is not a Spring ProxyMethodInvocation: " + curr);
|
||||||
|
}
|
||||||
|
pmi = currPmi;
|
||||||
|
thisObject = pmi.getProxy();
|
||||||
}
|
}
|
||||||
pmi = _pmi;
|
|
||||||
thisObject = pmi.getProxy();
|
|
||||||
}
|
}
|
||||||
catch (IllegalStateException ex) {
|
catch (IllegalStateException ex) {
|
||||||
// No current invocation...
|
// No current invocation...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue