Spring Boot –開始するメインクラス
Spring Bootプロジェクトに複数のメインクラスが含まれている場合、Spring Bootは展開またはpackagに失敗します。
ターミナル
$ mvn package #or $ mvn spring-boot:run Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.2.RELEASE:run (default-cli) Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.4.2.RELEASE:run failed: Unable to find a single main class from the following candidates [com.example.Test, com.example.SpringBootWebApplication] -> [Help 1]
Mavenの例
1.1 Define single main class via start-class
properties
pom.xml
com.example.SpringBootWebApplication
1.2 Alternatively, define the main class in the spring-boot-maven-plugin
pom.xml
org.springframework.boot spring-boot-maven-plugin com.example.SpringBootWebApplication