找不到SpringApplication类

时间:2017-10-27 14:34:44

标签: java spring maven spring-boot

我使用Maven将spring-boot工件添加为依赖项。

SpringApplication class not found in spring-boot-starter-actuator version 1.5.8.RELEASE. 

它被移动了吗?

POM代码段

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.8.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

使用版本1.5.7.RELEASE后,我没有找到该课程的问题。

代码

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

    public static void main(String[] args) throws Throwable {
        SpringApplication.run(Application.class);
    }
}

1 个答案:

答案 0 :(得分:0)

班级org.springframework.boot.SpringApplication位于spring-boot jar中,而不是spring-boot-starter-actuator -starter - JAR只是包装POM,呈现一组策划的依赖项所以spring-boot-starter-actuator jar永远不会包含SpringApplication

你可以获得spring-boot-1.5.8.RELEASE.jar from Maven Central,它肯定包含org.springframework.boot.SpringApplication

相关问题