On WebSphere application server (multi-node config) spring context initialization is very slow, our application has big classpath that causes classloader to be quite slow(see WAS_startup.png). After adding cache to ReflectionUtils.findMethod and AnnotationUtils.findAnnotation (see patch.patch) spring context seems to initialize a lot faster (see ReflectionUtils.png and AnnotationUtils.png).
Thanks for pointing this out! We weren't aware that this can be such a hotspot; it's a shame that the JVM itself isn't better at caching reflection results there.
So ReflectionUtils caches Class.getDeclaredMethods() results now, as suggested. AnnotationUtils caches findAnnotation results both for classes and for methods, along the lines of what you suggested.
That said, it's not yet decided how much of this is going to be backported. The ReflectionUtils change seems like an obvious candidate for both 4.0.6 and 3.2.10 next week; however, the AnnotationUtils change leads to a harder-to-predict memory consumption profile, so it might fit for 4.0.6 still but not so much for 3.2.10, I'm afraid.
What do your upgrade plans look like? Are you aware that you can upgrade to Spring Framework 4.x even when deploying to WebSphere 7?
We've added a patched version of spring-core to our application, so we can wait for 3.2.10. As for 4.x upgrade, our project uses over 40 000 beans so we need to plan this separately.
Thank you for quick response :)