我使用Maven来添加spring引导工件作为依赖项。
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版本的version之后,我没有问题找到这个类。
码
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);
}
}发布于 2017-10-27 14:43:43
类org.springframework.boot.SpringApplication驻留在spring-boot jar中,而不是在spring-boot-starter-actuator中,starter jar只是包装POMs,呈现一组经过管理的依赖关系,因此spring-boot-starter-actuatorjar从未包含SpringApplication。
您可以得到spring 1.5.8.RELEASE.jar 来自Maven Central,它肯定包含org.springframework.boot.SpringApplication。
https://stackoverflow.com/questions/46977543
复制相似问题