1.new project
2.spring intializr
3.填写组织名称和项目名
4.左边选择web,右边选择springweb
5.指定项目路径后就完成了
6.新建com.example.demo_zhang.web,在其目录下新建类HelloController。
package com.example.demo_zhang.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@RequestMapping("/hello")
public String hello() {
return "Hello Spring Boot!";
}
}
7.启动DemoZhangApplication,然后访问http://127.0.0.1:8080/hello