1. 打开idea
2. 依次点击File->new->Project
3. 选择Maven点击next,第一次创建的时侯在Project SDK处需要选择jdk
![](https://i-blog.csdnimg.cn/blog_migrate/a282db40a07b31b0d11f7fee5fe2a2f4.png)
4. 输入项目名称及项目存放路径,坐标会出现在pom.xml中为Maven做准备
![](https://i-blog.csdnimg.cn/blog_migrate/b89fb1752983321947763f098760d443.png)
5. 在pom.xml中导入SpringBoot相关依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
6. 编写一个主程序;启动Spring Boot应用
@SpringBootApplication
public class HelloWorldMainApplication {
public static void main(String[] args) {
SpringApplication.run(HelloWorldMainApplication.class,args);
}
}
7. 编写相关的Controller、Service
@Controller
public class HelloController {
@ResponseBody
@RequestMapping("/hello")
public String hello(){
return "Hello World!";
}
}
8. 浏览器输入localhost:8080/hello就可以执行起来了