Bootstraphard3-5 years
Walk through what happens between SpringApplication.run() and the app accepting its first HTTP request.
SpringApplication.run() prepares the environment (property sources, profiles), creates the ApplicationContext, refreshes it — which instantiates and wires every singleton bean including a ServletWebServerFactory — and, as part of that refresh, the web server factory creates and starts an embedded Tomcat (or Jetty/Undertow) instance bound to the configured port. Only once that server is listening does the run complete and the app start accepting connections; readiness/liveness events fire around this point for anything that needs to know.
PreviousWhat is a Spring Boot starter, and how does spring-boot-dependencies keep all those library versions compatible?Next How does Spring Boot decide which value wins when the same property is set in application.yml, a profile-specific file, an environment variable and a command-line argument?