
接收方法改造
@RequestMapping(value = "/users/{id}", method = RequestMethod.DELETE)
@ResponseBody
public String delete(@PathVariable Integet id)
{
return "";
}
@RequestBody 用于接收json数据
@RequestParam 用于接收url地址传参或表单传参
@PathVariable 用于接收路径参数,使用{参数名称}描述路径参数
简化开发
@RestController
@ResquestMapping("/books")
public class BookController
{
@DeleteMapping("/{id}")
public String delete(@PathVariable Integet id)
{
return "";
}
@PostMapping
public String save(@RequestBody Book book)
{
return "";
}
}
浙公网安备 33010602011771号