@PathVariable
获取url中的数据
该注解是实现RESTFull最主要的一个注解
eg:
package com.example.controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; /** * restfull */ @RestController public class RESTFullController { //访问地址http://localhost:8080//boot/restfullstudent/id/status @RequestMapping("/boot/restfullstudent/{id}/{status}") public Object restfullstudent(@PathVariable("id") Integer id,@PathVariable("status") Integer status){ Map<String,Object> map=new HashMap<String,Object>(); map.put("id",id); map.put("status",status); return map; } }