idea新建SpringBoot项目问题总结
idea新建SpringBoot项目问题总结
1、依赖包下载过慢或失败问题
-
添加阿里镜像源
-
本地maven安装路径下 -> conf -> settings.xml
-
使用文本编辑器打开文件,找到
标签 -
在便签内添加以下代码块,保存退出即可
<mirrors> <!-- 需要添加的内容如下 --> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror> </mirrors>
-
2、对@RestController报错
错误如下图:
-
在项目配置文件pom.xml中添加对spring-boot-starter-web的依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>