一、映射路径变量得到的请求参数:
// http://localhost:8081/api/v1.0/users/ming
@GetMapping("/{name}")
@PathVariable String name
{"createDate":"2021-08-12T15:36:03.801055+08:00","name":"ming"}
// http://localhost:8081/api/v1.0/users/list/11
@GetMapping("list/{ids}")
@PathVariable long[] ids
[{"id":11}]
二、例子:
@RequestMapping("/api/v1.0/users")
public class UserProfileController {
private static CxLogger logger = CxLogManager.getLogger();
@GetMapping("/{name}/{age}")
public UserProfile hello(@PathVariable String name, @PathVariable Integer age) {
UserProfile profile = new UserProfile();
profile.setName(name);
profile.setName(age);
profile.setCreateDate(OffsetDateTime.now());
return profile;
}
@GetMapping("l