json参数
post请求格式
@RestController
public class HelloController {
//json参数 post 请求
@RequestMapping("/jsonParam")
public String jsonParam(@RequestBody User user){
System.out.println(user);
return "OK";
}
}
postman 接口测试工具
日期格式
get请求
@RestController
public class HelloController {
@RequestMapping("/dataParam")
public String dataParam(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
LocalDateTime updateTime){
System.out.println(updateTime);
return "OK";
}
}
路径参数
@RequestMapping("/path/{id}")
public String pathParam(@PathVariable Integer id){
System.out.println(id);
return "OK";
}