1、创建项目
这里我们使用idea 来新建一个SpringBoot 项目。
Spring初始化器
新建controol层
package com.kcbg.hellospringboot.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @program: hello-spring-boot
* @description: 你好SpringBoot
* @author: MW
* @create: 2020-06-12 19:13
**/
@RestController
public class HelloSpringBoot {
@GetMapping("/hello")
public String sayHi(){
return "你好SpringBoot";
}
}
把application后缀修改成yml格式的快捷键(Shift+F6)再指定一个端口号
启动项目访问
http://localhost:8082/hello