2. At the time of SpringApplication object creation
There are two overloaded constructors in SpringApplication class. This is dummy constructor which uses the other constructor. This constructor is used when we do not have the resource loader. On line no 281 your provided class the main class is registered. On line no 282 it checks what kind of application it is. By the time I am writing this blog Spring introduced three kind of web application type. NONE , SERVLET and REACTIVE . But wait how does it decide that its what kind of application? With the help of ClassLoader it checks the classpath whether only servlet of reactive type is present i.e. org.springframework.web.reactive.DispatcherHandler . If only this servlet is present then it is confirmed that it is a REACTIVE kind of web application. For normal web application it checks for the only servlet class i.e. javax.servlet.Servlet, org.springframework.web.context.ConfigurableWebApplicationContext. On line no 283 first all the instances of the ...