使用IDEA创建第一个SpringBoot项目
最近,在学习Spring boot,记录一点学习过程,使用IDEA创建。
1.打开IDEA,创建新项目,选择Spring Initializr
2.输入Artifact
3.勾选Web
4.点击finish完成
5.进入项目,可以将以下内容删除
6.创建一个HelloController
package com.example.springboot;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//返回json格式数据
@RestController
public class helloController {
@RequestMapping("/hello")
public String hello() {
return "hello,this is a springboot demo !";
}
}
7.运行SpringbootApplication类
8.测试
在地址栏中输入http://localhost:8080/hello
ok!!!