-
Couldn't load subscription status.
- Fork 38.8k
Description
In the production environment, I discovered that AdvisedSupport#methodCache contains two "identical" keys, both corresponding to the same method object.
Experimentally, I found that the methodCache established during bean initialization is practically useless. During actual method invocation, the interceptor chain retrieved via methodCache.get(cacheKey) turns out to be empty. Thus, the interceptor chain is fetched again using advisorChainFactory and then placed into the methodCache. This means that the initialization logic related to getInterceptorsAndDynamicInterceptionAdvice will not only execute during bean initialization but also during the first method invocation.
Returning to the issue itself, since each call to getClass().getDeclaredMethods()[0] results in a Method object that, when compared using ==, returns false (even if it's the same method), I believe the equals method of MethodCacheKey is poorly designed.