无法解析 org.springframework.context.ConfigurableApplicationContext 类型。它从所需的.class文件中间接引用
2022-09-02 23:03:21
我正在按照 spring.io 的教程使用spring boot构建一个spring应用程序。
我可以让程序在一台计算机上完美运行。当我在另一台计算机上尝试时,我收到以下错误
无法解析 org.springframework.context.ConfigurableApplicationContext 类型。它从所需的.class文件中间接引用
我尝试删除和添加我的JRE系统库(JDK 1.8),以及使用maven清理和更新项目,甚至删除并重新导入整个项目。所有这些方法都没有成功。
我的 pom 文件是
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<groupId>test.api</groupId>
<artifactId>api.test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>api.test Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<java.version>1.8</java.version>
</properties>
<build>
<finalName>api.test</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
给我带来错误的类是HelloWorldConfiguration.java类
package hello;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloWorldConfiguration {
public static void main(String[] args) {
SpringApplication.run(HelloWorldConfiguration.class, args);
}
}
任何帮助将不胜感激。谢谢。