feiyuerenhai
feiyuerenhai

Reputation: 308

how does maven-spring-boot-plugin determine the main class?

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 ?

Upvotes: 0

Views: 925

Answers (1)

Christopher
Christopher

Reputation: 142

  1. Yes, compile everything in the "ClassPath". In this case is the src/main/java you mentioned.

  2. It will look for the main method which is in a class with @SpringBootApplication annotation.

Upvotes: 1

Related Questions