1:在路径上传递参数
使用@PathVariable接收
@GetMapping("/login/getCaptcha/{id}")
public ModelResult<String> getCaptcha(@PathVariable String id) throws IOException {
return new ModelResult();
}
2:在路径后传递参数
使用@RequestParam(“xxx”)接收
@GetMapping("/demo")
public String demoOne(@RequestParam("param") String param){
System.out.println("param:"+param);
return paramName;
}
3:在请求体里传递参数
@PostMapping(value = "/demoTwo")
public void demoTwo(@RequestBody DemoTwo demo) {
//处理逻辑
}