1.新建项目
第一步:
第二步:
第三步:
第四步:
目录:如图
2.修改配置文件
- 我比较喜欢yml文件的写法,所以先把application.properties改为application.yml,也可以不改,但是要注意写法
- 设置启动端口号
3.编写测试代码
package com.dahai.springbootweb.test.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class TestController {
@RequestMapping("/test")
public String test() {
return "hello TestController";
}
}
4.启动并测试