본문 바로가기
Spring

[Spring] ERROR : Unable to find a single main class from the following candidates

by diaryDev 2024. 9. 9.
728x90

원인

main()이 두 개여서 발생한 ERROR이다.

 

해결 방안

• Maven

<properties>
	<!-- main 메소드 명시 -->
    <start-class>com.example.TestApplication</start-class>
</properties>

  

• Gradle

// build.gradle
// main 메소드 명시
springBoot {
    mainClassName = 'com.example.TestApplication'
}

 

 


 

 

참고

https://stackoverflow.com/questions/23217002/how-do-i-tell-spring-boot-which-main-class-to-use-for-the-executable-jar

728x90