There is a start up performance issue, if I configure beans for an application with JavaConfig (JavaConfing with more than 100 beans). The time to create the beans increases significantly more than when I configured the beans via XML-Based. I have performed a profile on the project and found that the problem lies in the MethdoeRefelctionUtils. getUniqueDeclaredMethods()( This method try to filteries out overrided methods from superclass).
But if I break the JavaConfig down into smaller files (each file 10 beans), than the start will be performed quickly. I'm well aware that it is better to have smaller files, however, it is the algorithm of the method RefelctionUtils.getUniqueDeclaredMethods () badly designed when more than 100 beans......
I've just attempted to reproduce this issue without any success. Take a look at commit cb8dc73. Try this yourself by building from source, just ensure that you do the following once you've cloned the repository locally:
your are right, your test actually requries only 10 milliseconds for 100 Methods because you have tested the isolated refelctionmethod. The Problem only accurs in combination with SpringBeans. If you configure with JavaConfig, your SpringBeans will take 92 millisecondsds for 100 beans. I also tired my test with 300 Beans and the result is 6248 milliseconds.
Note that, after the initial report of this issue here, #16501 introduced a cache for ReflectionUtils.getDeclaredMethods already which is also being used through getUniqueDeclaredMethods(). Is the extra filtering in getUniqueDeclaredMethods() really so much extra overhead that it's worth some extra caching there?