我的代码运行正常,但在邮递员方面显示错误
"此请求标识的资源只能根据请求生成具有不可接受特征的响应"接受"报头&#34。
发布的数据来自restController
,serviceImpl
和Studentimpl
。
我的restController
是
@RequestMapping(value="save",method=RequestMethod.POST,produces="application/json")
GetStudentSaveResponse saveResponse(@RequestBody GetStudentSaveRequest saveRequest)
{
System.out.println(saveRequest.getName());
System.out.println(saveRequest.getAddress());
return serviceIntf.saveResponse(saveRequest);
}
RestImpl is
@Override
public GetStudentSaveResponse saveResponse(GetStudentSaveRequest saveRequest) {
GetStudentSaveResponse saveResponse = new GetStudentSaveResponse();
studentIntf.SaveStudent(saveRequest.getName(), saveRequest.getAddress());
System.out.println("SERVICE"+saveRequest.getName());
return saveResponse;
}
实施类是:
public void SaveStudent(String name, String address) {
try
{
java.sql.Date date = new java.sql.Date(new java.util.Date().getTime());
con=jdbctemplate.getDataSource().getConnection();
CallableStatement call = con.prepareCall("{Student_pro(?,?,?,?,?)}");
call.setString(1, "insertStudent");
call.setInt(2, 0);
call.setString(3, name);
call.setString(4, address);
call.setDate(5, date);
System.out.println(name);
System.out.println(address);
}catch(Exception e){e.printStackTrace();}
}