Issue
What is the entry point of a spring boot application?
While going through a Spring Boot application code, all that it says is there is a code
public static void main having - SpringApplication.run(Application.class, args)
Example - href="https://github.com/in28minutes/spring-boot-examples/blob/master/spring-boot-2-rest-service-with-hateoas/src/main/java/com/in28minutes/springboot/rest/example/SpringBoot2RestServiceApplication.java" rel="nofollow noreferrer">SpringBoot2RestServiceApplication.java .
But how to get to know what is the entry point, just by going through the code. Earlier, if we go through applicationContext.xml
- example - applicationContext.xml, we could understand the flow.
Is there any way, or maybe a standard to follow to make this understanding self-explanatory?
My question was more of understanding the flow of the application than finding the main class. One option could be separating configurations(@Configuration) to a separate class having multiple @Bean annotations, this would help in finding all bean wirings at one place. Is there a standard that large projects use to make code flow understandable?
Solution
I think the OP is studying an existing Spring Boot application, and is asking how to locate any runner, such as Application Runners, Command Line Runners, MVC controllers, Rest controllers, etc.
I don't know if there is an easy way to locate those, unless they are grouped together in the original design.
It's a difficult problem to do programmatically, because threads can be launched outside of Spring, for example in a constructor or a @PostConstruct.
It would be nice though if there were IDE support to easily locate anything that gets launched by Spring Boot
Answered By - Victor Grazi
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)