首页 > 代码库 > spring项目加载非常慢

spring项目加载非常慢

  1. 请检查spring是否运行在debug模式下,是跳转到2 否则跳转到3

  2. 查看spring在run模式下是否运行依旧缓慢 是跳转到3,否则跳转到4

  3. 请检验是否spring bean加载了多次(quartz加载很有可能导致部分bean被是实例两次) 是跳转到 http://blog.csdn.net/chaijunkun/article/details/6925889 否则跳转到 http://jinnianshilongnian.iteye.com/blog/1883013 按照步骤检验

  4. 请将代码中所有代码断点禁用掉或者全部删除重新进入到debug模式下查看加载速度是否变快 


发现debug模式下可能导致应用启动速度大幅度变慢。将breakpoint删除后我的应用从 171021ms+43824 ms=====》13021ms+2950ms

解决方案:stackoverflow

i have a java web application, using Spring, Jersey (jax-rs) and Hibernate.

It runs fine and fast, but there are some days it takes a big amount of time to initialize in debug mode only and when it starts is really slow...

I‘m using Eclipse 3.6, Apache Tomcat 6 and java 1.6.0_29 for MAC OS X.

Application begin to log slow after writing this log line:

INFO: Initializing Spring root WebApplicationContext

and before this log lines:

30-dic-2011 10.51.25 com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
    com.example.project.web.rest

How can I investigate? Any suggestions?

Unfortunately I really don‘t know what I did to reduce performance..

Thanks a lot for help! Davide.




One thing that‘s helped me in a similar situation is to delete all breakpoints in Eclipse. It‘s worth a try.

   http://stackoverflow.com/questions/8678409/java-spring-web-application-starts-slowly-in-debug-mode

spring项目加载非常慢