I am quite new to the java world, and recently I have been trying to grasp some ideas about how spring-boot works.
I am confused about some questions.
1, when I do mvn install
, does the compiler normally compile all the classes in the src/main/java
dir, even among them some are not used ?
2, I know somehow the plugin maven-spring-boot-plugin
defined in pom.xml
does all the magic for a spring application to start up, but, how does it determine which class is the Main-Class ? via traversing all the compiled classes to find one with public static void main
?
CodePudding user response:
Yes, compile everything in the "ClassPath". In this case is the
src/main/java
you mentioned.It will look for the main method which is in a class with
@SpringBootApplication
annotation.