Posts

2. At the time of SpringApplication object creation

Image
 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 ...

1. What happens after the start of main class?

Image
  Here is our main class .       The line no 12 is where the magic starts. There is a static run method in the SpringApplication class. When this static method is called two things happens. 1. Object of  SpringApplication is created which takes your passed class name. i.e.                          DepartmentServiceApplication.class. 2. After the successful creation of SpringApplication class object its run method is called.    Once the run method executed successfully then it returns the ApplicationContext type object. Wait!! Are you thinking what happens  at the time of  SpringApplication object creation? Are you thinking what happens when run method executed? Check out my next blog till then, Jai Hind!