我对STS很新。我在stackoverflow中搜索了这个错误。我找不到正确的匹配答案。
我能够在STS中看到Maven Dependencies部分中的类,但是无法在我的java类中添加注释。
qazxsw poi我们将非常感谢您的帮助。谢谢
从命令行运行bellow命令
Right click on project -> Maven -> Update Project
选择项目并做一个maven-> update这解决了我的问题
只需将您的弹簧启动版本从1.5.8更改为1.5.6。相信我,我已经尝试了所有其他解决方案,但只有这个解决方案适合我。
清除.m2 /文件位置下的org / springframework / boot文件夹,并在项目下运行mvn clean install命令
上述解决方案都不适用于我,因为我的代码就是这样
mvn clean dependency:tree
mvn clean compile
我错过了导致此错误的<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<properties>
<java.version>1.8</java.version>
</properties>
标签。
在包声明下面添加import语句。
import org.springframework.boot.autoconfigure.SpringBootApplication;
您只需要将该注释添加到入口点,而不是每个类。它与拥有启动Spring的主要方法的同一个类...
<dependencies>
我有同样的问题。您可以使用 public static void main(String[] args) {
SpringApplication.run(CourseAPIApp.class, args);
}
目标构建项目来解决它。