我在尝试通过 Swagger 发布请求时收到以下错误。当我通过邮递员这样做时,这很好。我使用的是弹簧靴版本 = “2.1.0.发布”, 摇摆版本 = '2.9.2'。这是我的 Json 映射类。数据导出.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
	提交
		取消
	
