Java 更新端点的响应对象

Java 更新端点的响应对象,java,spring,spring-mvc,Java,Spring,Spring Mvc,我使用swagger自动生成了SpringMVCAPI。现在我想手动更新一些端点。 我有以下结论: @ApiOperation(value = "Estimation of ...", notes = "...", response = Similarity.class, responseContainer = "List") @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiRe

我使用swagger自动生成了SpringMVCAPI。现在我想手动更新一些端点。 我有以下结论:

  @ApiOperation(value = "Estimation of ...", notes = "...", response = Similarity.class, responseContainer = "List")
  @io.swagger.annotations.ApiResponses(value = { 
    @io.swagger.annotations.ApiResponse(code = 200, message = "Similarity metrics", response = Similarity.class),
    @io.swagger.annotations.ApiResponse(code = 200, message = "Unexpected error", response = Similarity.class) })
  @RequestMapping(value = "/estimateSimilarity",
    produces = { "application/json" },
    method = RequestMethod.GET)
  public ResponseEntity<HashMap<String,Double>> estimateSimilarity(
          @ApiParam(value = "...", required = true)
          @RequestParam(value = "term1", required = true) String term,
          @ApiParam(value = "...", required = true)
          @RequestParam(value = "terms", required = true) List<String> concepts)
      throws NotFoundException {
      Similarity similarity = new Similarity();
      HashMap<String,Double> result = similarity.getEstimates(term1, terms);
      return new ResponseEntity<HashMap<String,Double>>(HttpStatus.OK);
  }
@ApiOperation(value=“估计…”,notes=“…”,response=Similarity.class,responseContainer=“列表”)
@io.swagger.annotations.ApiResponses(值={
@io.swagger.annotations.ApiResponse(code=200,message=“Similarity metrics”,response=Similarity.class),
@io.swagger.annotations.ApiResponse(code=200,message=“意外错误”,response=Similarity.class)})
@RequestMapping(value=“/estimateSimilarity”,
生成={“应用程序/json”},
method=RequestMethod.GET)
公众反应估计相似性(
@ApiParam(value=“…”,必需=true)
@RequestParam(value=“term1”,required=true)字符串术语,
@ApiParam(value=“…”,必需=true)
@RequestParam(value=“terms”,required=true)列表概念)
抛出NotFoundException{
相似性=新的相似性();
HashMap结果=相似度.getEstimates(术语1,术语);
返回新的响应状态(HttpStatus.OK);
}

我想返回的不是
response=Similarity.class
,而是
HashMap结果
。如何更新上述给定代码以返回此对象?

尝试修改ApiOperations响应容器

@ApiOperation(value = "Estimation of ...", notes = "...", response = Double.class, responseContainer = "Map")