springmvc下url参数带版本号
@GetMapping(value = "test11", params = "version=1")
public String test11(){
return "test11";
}
@GetMapping(value = "test11", params = "version=2")
public String test22(){
return "test22";
}
在springmvc下将版本号传入请求头
@GetMapping(value = "test22", headers = "version=1")
public String test33(){
return "test33";
}
@GetMapping(value = "test22", headers = "version=2")
public String test44(){
return "test44";
}
通过指定请求的媒体类型
@GetMapping(value = "test33", consumes = "application/api-v1+json")
public String test55(){
return "test55";
}
@GetMapping(value = "test33", consumes = "application/api-v2+json")
public String test66(){
return "test66";
}
|