title: Speed up Spring Boot startup time
body: <p>I have a Spring Boot application. I've added a lot of dependencies (unfortunately, looks I need all of them) and the startup time went up quite a lot. Just doing a <code>SpringApplication.run(source, args)</code> takes 10 seconds. </p>
  
  <p>While that might not be much compared to what are "used" to, I'm unhappy that it takes that much, mostly because it breaks the development flow. The application itself is rather small at this point, so I assume most of the time is related to the added dependencies, not the app classes themselves.</p>
  
  <p>I assume the issue is classpath scanning, but I am not sure how to:</p>
  
  <ul>
  <li>Confirm that is the issue (i.e. how to "debug" Spring Boot)</li>
  <li>If it really is the cause, how can I limit it, so it gets faster? For example, if I know that some dependency or package does not contain anything that Spring should be scanning, is there a way to limit that? </li>
  </ul>
  
  <p>I assume that <a href="https://jira.spring.io/browse/SPR-8767" rel="noreferrer">enhancing Spring to have parallel bean initialization during startup</a> would speed up things, but that enhancement request has been open since 2011, without any progress. I see some other efforts in Spring Boot itself, such as <a href="https://github.com/spring-projects/spring-boot/issues/1610" rel="noreferrer">Investigate Tomcat JarScanning speed improvements</a>, but that is Tomcat specific and has been abandoned.</p>
  
  <p>This article:</p>
  
  <ul>
  <li><a href="http://www.nurkiewicz.com/2010/12/speeding-up-spring-integration-tests.html" rel="noreferrer">http://www.nurkiewicz.com/2010/12/speeding-up-spring-integration-tests.html</a></li>
  </ul>
  
  <p>although aimed at integration tests, suggests using <code>lazy-init=true</code>, however I do not know how to apply this to all beans in Spring Boot using Java configuration - any pointers here?</p>
  
  <p>Any (other) suggestions would be welcome.</p>