文章目录
新建一个Springboot项目
File -> New Project 根据下图指引做:
点击next,选择Springboot版本和组件,版本可以跟我不同:
点击 Finish完成项目创建,然后开始导入Pom依赖
如果依赖下载的太慢的话,可以使用aliyun,方法是在你的 pom.xml里加入下面的代码:
<repositories>
<repository>
<id>nexus-aliyun</id>
<name>nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
加完之后再刷新一下:
导入依赖之后会出现Springboot的启动按钮
直接点击绿色的三角启动运行项目。运行效果:
看到这个 8080 表示你的项目启动好了
开始写文件上传接口
package com.example.demo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping</