【发布时间】:2018-05-14 23:32:38
【问题描述】:
从 SPRING STS 我创建了一个全新的 spring boot 项目启动器,我添加了“WEB”功能,然后完成了项目的创建
由于某种原因导入
import org.springframework.boot.autoconfigure.SpringBootApplication;
无法识别(我得到-“无法解析导入 org.springframework.boot.autoconfigure.SpringBootApplication”)
因此@SpringBootApplication注解也无法识别
package com.test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Newtest1sdfsdfApplication {
public static void main(String[] args) {
SpringApplication.run(Newtest1sdfsdfApplication.class, args);
}
}
注意:我使用的是自动创建的项目
如果我更改 spring-boot-starter-parent 的项目版本(在 pom.xml 中) 从 1.5.9 到 1.5.8 - 一切都好起来了。设置回 1.5.9 显示错误
意思从:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
到
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
有什么想法吗?
【问题讨论】:
-
试试this SO post的建议。我找不到上述版本的任何问题...
标签: spring-boot