快速创建Springboot项目
一、创建Springboot项目
- 启动idea:File—New—Project
![](https://i-blog.csdnimg.cn/blog_migrate/ff9a56f426080285946d3d30107687e0.png)
- 选择Spring Initializr并选择自己的jdk——Next
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/080849fdcaae97cc8ec409e8321fc30b.png)
- 输入新建项目的信息——Next
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/5d5c8aa63ba04a9a2a5fcae2f0aa1269.png)
- 选择:Web—SpringWeb—Next
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a092b72c59f639850c15f84ccc430ba0.png)
- 确认信息——Finish
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/ce3d4d23163683bf7915463ab4fec595.png)
6.创建包:controller并新建HelloSpringBootController类
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/9b425ca34d1dcff337de58f618e74ce7.png)
HelloSpringBootController类:
package com.xiaobai.springbootweb.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@ResponseBody
public class HelloSpringBootController {
@RequestMapping("/hello")
public String helloSpringBoot(){
return "你好SringpBoot";
}
}
二、启动并测试项目
- 运行SpringbootwebApplication类
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/bba5b6ae1ee52c8f73fec54c2d2ef917.png)
- 启动成功后,浏览器访问http://localhost:8080/hello
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/17b0323d299d0063cd6e85e49d3b9682.png)
这样,一个SpringBoot项目就创建起来了。