Springブートプロジェクトに複数のメインクラスが含まれている場合、Springブートはデプロイメントの開始またはパッケージ化に失敗します。

ターミナル

$ 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.mkyong.Test, com.mkyong.SpringBootWebApplication]->[Help 1]....

===  Mavenの例

1.1 `start-class`プロパティを使って単一のメインクラスを定義する

pom.xml

<properties>
    <!-- The main class to start by executing java -jar -->
    <start-class>com.mkyong.SpringBootWebApplication</start-class>
</properties>

1.2また、 `spring-boot-maven-plugin`でメインクラスを定義してください

pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.mkyong.SpringBootWebApplication</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

=== 参考文献

.  https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html[Spring

ブート - 実行可能なjar形式]。 http://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html[Spring

Boot Maven Plugin  - 使い方]

link://tag/executable-jar/[実行可能なjar]link://タグ/jar/[jar]link://tag/main-class/[main class]link://タグ/spring-boot/[spring boot]link://tag/war/[war]