工具:STS
問題:description The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.
中文意思:
Status 415 服務器拒絕了這個請求因爲請求實體格式的請求資源的請求的方法不支持。
原因: @RequestMapping(value = "/tbValue", method = RequestMethod.GET)
@ResponseBody
public String tbValue(@RequestBody String req) {
return "836";
}
在訪問這個方法的時候,我沒有加參數,所以格式不對,所以要在地址欄跟上參數,或者你就去掉req參數
在訪問rest服務的時候,返回類型必須是String類型的,否者也會報錯這個錯誤