SpringBoot: Unable to find a single main class from the following candidates

后端 未结 11 1906
旧巷少年郎
旧巷少年郎 2020-12-13 00:06

I\'ve generated a Spring Boot web application using Spring Initializer, embedded Tomcat, Thymeleaf template engine.Technologies used: Spring Boot 1.4.2.RELEASE, Spring 4.3.4

11条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 00:37

    If you have a Spring Boot Application generally there is only one main class that has @SpringBootApplication , If you add another main method in the application some where , the gradle build process gets confused . So add the following at the root level of your build.gradle file

    apply plugin: 'application'
    mainClassName = 'packageNameAfter.srcMainJavaFolder.YourClassName'
    

提交回复
热议问题