2

I have a java web app which have in its \WEB-INF\lib\ folder around 679 jars. I have read the classloaders (the app is using TomcatEmbeddedWebappClassLoader) read in alphabetical order this folder in order to find a class and load it. If this is the way, a class that its contained in the last jar will take much more time to find it by the classloader than its contained in the first jar in the list.

  • Is this true that the classloader reads the contents of lib folder in alphabetical order?
  • Is not there any optimization in order the classloader finds a class in a huge list of jars? Or it just unzips jar by jar in order to find the class?

Thanks

fernando1979
  • 1,727
  • 2
  • 20
  • 26
  • 1
    Does this allow your question https://stackoverflow.com/questions/59242577/why-my-springboot-with-embbeded-tomcat-too-slow-when-process-first-request? – 0xh3xa Jul 20 '22 at 16:30
  • Hi, it explains about optimization but not explains about the the reading order of jars – fernando1979 Jul 21 '22 at 11:31
  • About optimization, I found an answer here too: https://stackoverflow.com/questions/2020800/how-does-java-efficiently-search-jar-files-for-classes – fernando1979 Jul 21 '22 at 13:10

0 Answers0