解决办法: 1.网上很多人说添加spring什么(试过没用) 2.删除此模块,重新创建该模块(试用后无用) 3.查看模块下的依赖性:spring-boot-starter-web(成功)
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
将这种依赖引入项目,然后在pom文件中 右键–> Maven --> Reimport 重新加载后,文件变成绿叶。