A few additional tips which may be helpful.
- Use OpenJ9 instead of Hotspot for development
- If you use Hibernate, set
hibernate.ddl-auto=none instead of update
- Set vmargs to -Xquickstart
- If you use OpenJ9 - set vmargs to -XX:TieredStopAtLevel=1 -noverify
- If you use Hotspot - use IDE build instead of Gradle build
- Use Undertow instead of Tomcat
- Don't abuse annotation processing tools (mapstruct, immutables...) which will slow down the build process
In addition:
As this article recommends use @ComponentScan(lazyInit = true) for local dev environment.
TL;DR
What we want to achieve is to enable the bean lazy loading only in your local development environment and leave eager initialization for production. They say you can’t have your cake and eat it too, but with Spring you actually can. All thanks to profiles.
@SpringBootApplication
public class LazyApplication {
public static void main(String[] args) {
SpringApplication.run(LazyApplication.class, args);
}
@Configuration
@Profile("local")
@ComponentScan(lazyInit = true)
static class LocalConfig {
}
}