org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing
org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing: public com.crm.lessn.utils.DataResult com.crm.lessn.controller.MyClientController.query_contact_records(java.lang.String)
出现这个是问题请求出问题,将@RequestBody去掉即可(这里发的get请求)
$.ajax({
type: "GET",
url: "/api/query_contact_records",
async: false, //改为同步请求
contentType: 'application/json;charset=UTF-8',
data: data.customer_submodule_id,
dataType: 'json',
beforeSend: function (request) {
request.setRequestHeader("authorization", CoreUtil.getData("access_token"));
request.setRequestHeader("refreshToken", CoreUtil.getData("refresh_token"));
},
complete: function (res) {
},
success: function (res) {
},
error: function (data) {
}
});
后端接收
@GetMapping("/query_contact_records") @ApiOperation(value = "查询联系记录列表接口") @MyLog(title = "联系记录",action = "联系记录查询") public DataResult query_contact_records(String customer_submodule_id) { DataResult result =DataResult.success(); System.out.println(customer_submodule_id); /* List<Contact_Person> contact_person = contact_personMapper.selectByPrimaryKey(customer_submodule_id); result.setData(contact_person);*/ return result; }