I have a Spring Boot application. I added a lot of dependencies (unfortunately, I need all of them), and the startup time has greatly increased. Simple execution of SpringApplication.run(source, args) takes 10 seconds.
Although this is not so much compared to what theyβre used to, Iβm unhappy that it takes so much, mainly because it breaks the development process. The application itself is currently quite small, so I assume that most of the time it is associated with added dependencies, and not with the application classes themselves.
I assume the problem is scanning the classpath, but I'm not sure how:
- Confirm that this is a problem (for example, how to "debug" Spring Boot)
- If this is really the reason, how can I limit it to make it faster? For example, if I know that some kind of dependency or package does not contain anything that Spring should scan, is there a way to limit this?
I assume that the Spring extension for parallel initialization of the bean at startup will speed up the process, but this improvement request has been open since 2011 without any progress. I see some other efforts in Spring Boot itself, such as Investigate Tomcat JarScanning, speed improvement , but this is specific to Tomcat and was abandoned.
This article:
Although it focuses on integration tests, it suggests using lazy-init=true , however I don't know how to apply this to all beans in Spring Boot using the Java configuration - are there any pointers here?
Any (other) suggestions would be welcome.
java performance spring spring-boot startup
steady rain Dec 01 '14 at 2:37 a.m. 2014-12-01 14:37
source share