我在嘗試通過 Swagger 發(fā)布請求時收到以下錯誤。當我通過郵遞員這樣做時,這很好。我使用的是彈簧靴版本 = “2.1.0.發(fā)布”, 搖擺版本 = '2.9.2'。這是我的 Json 映射類。數(shù)據(jù)導(dǎo)出.java@XmlRootElement(name = "DataExport")public class DataExport{ @JsonProperty("engineName") private String engineName; @JsonProperty("searchQuery") private String searchQuery; public DataExport() { super(); } public DataExport(String aEngineName, String aSearchQuery) { super(); this.engineName = aEngineName; this.searchQuery = aSearchQuery; }RestController.java@RequestMapping(value = "/export", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.TEXT_PLAIN_VALUE) @ApiOperation(authorizations = { @Authorization(value = "oauth") }, value = "Initiates the job for export", response = String.class) @ApiResponses({ @ApiResponse(code = 200, message = "Request accepted."), @ApiResponse(code = 500, message = "The export could not be started due to an internal server error.") }) public String getJobId(@RequestBody DataExport aDataExport, HttpServletResponse aResponse, @Value("${com.xyz.dataexportmodule.defaultfilelocation}") final String aLocation) throws Exception { LOG.info("Initializing export for Engine {} and Query {}", aDataExport.getEngineName(), aDataExport.getSearchQuery()); String exportLocation = aLocation....我想傳遞這個 json { “引擎名稱”:“ABC”,“搜索查詢”:“*”}但是我得到這個錯誤:nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `com.xyz.dataexportmodule.persistence.entity.DataExport` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('string') at [Source: (PushbackInputStream); line: 1, column: 1]]我無法弄清楚問題所在,有人請幫忙。
添加回答
舉報
0/150
提交
取消