method
设置接收请求的方式,可以设置成数组。
- method = RequestMethod.POST(单条记录)
- method = {RequestMethod.DELETE,RequestMethod.GET} (数组,设置多个请求方法)
但是在spring4.3之后提供了更便捷的请求方式 - GetMapping
- PostMapping
- ......
params
用来限制请求中的参数
// 必须要求请求中携带username参数
params={"username"}
// 不能携带username参数
params={“!username”}
// 必须要求请求中携带username参数,且username的值为"123"
params={"username=123"}
// username参数必须不等于"123"
params={"username!=123"}
headers
需要包含对应的请求头,才可以访问该地址
header={"header-key=XX"}
consumes
设置映射的文件类型
consumes={“application/x-www-form-urlencoded”}
produces
设置响应的文件类型
produces={"application/json"}
网友评论