1.首先我用的是火狐插件restclient来测试各种接口,具体怎么安装,同学们可以自行百度。
2.因为我接口参数是一个对象,requestbody注解。
@RequestMapping(value="/save",method=RequestMethod.POST)
public String save(@RequestBody(required=false)TSite record) {
}
3.在测试接口的时候,方法选择post,参数把对象的属性添加进去,如下
{
"fRegid":1,
"fSitetype":1,
"fSitename":"test",
"fCorpid":1,
"fDevicecount":2,
"fMaintainid":1
}
4,最最重要的一点就是 添加一个自定义的请求头
Content-Type: application/json
这样就可以了