创建SpringBoot项目
1,创建spring Initializr项目
2,
3,
4,
5,
以上项目创建完成
测试一下:
在com.example.demo下新建controller子包,在其子包中创建一个类
package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class SayHelloController {
@RequestMapping("index")
@ResponseBody
public String sayHello(){
return "hello World";
}
}
运行项目
输入网址:http://localhost:8080/index,查看执行结果
以上就是SpringBoot的创建步骤,以及简单的执行测试。