spring使用中,放在参数位置的注解
@PathVariable
搭配rest风格的{xx}使用
@RequestMapping("{id}")
//使用@PathVariable注解获取路径上配置的具名变量,该配置可以使用多次
// @RequestMapping("{id}")的id要与@PathVariable("id")对应
public String restLocation(@PathVariable("id") Integer id){
@RequestParam
设置参数,参数名+是否必须
@RequestParam(value = "latitude", required = false)
设置参数,参数名+默认值
@RequestParam(value = "pagesize", defaultValue = "10")
上传文件使用该注解
@RequestParam("headPhoto") MultipartFile file //上传文件
@RequestBody
当传入参数是json字符串时使用,该注解能自动解析json格式字符串
@RequestBody Map<String, String> param
@RequestHeader
从请求头中获取参数
@RequestHeader("Authorization") String