首先是创建一个项目
选择对应的spring
添加相应的web依赖
添加对应的Web接口
package com.itany.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Web {
@GetMapping("/hello")
public String maap(){
return "你还是很不错嘛";
}
@PostMapping("/hello")
public String hell0(){
return "返回你的小星星";
}
}
配置ymal文件
在springboot中,我们启动的配置不再是用properties文件了,取而代之的是ymal文件。
注意了!注意了!
这里配置的yaml文件必须是以properties.yml为文件名的,才能建立=成,不然建立成的yaml是无效的。
这样启动之后就可以了