Spring:RESTWebService调用

Spring:RESTWebService调用,spring,web-services,rest,spring-mvc,spring-data,Spring,Web Services,Rest,Spring Mvc,Spring Data,我试图将查询附加到customerDoaImpl文件中的服务url中,但它没有返回正确的值。我试图在服务端使用soapUI进行测试,但它正在向我的请求返回正确的数据 我正在尝试根据productId和datePeriod搜索结果 这是我的代码片段- url.append(getServiceUrl()).append( "/transaction/find/customerrequestv2?id={productId}&dateperiod={Dateperiod}"); 服务端

我试图将查询附加到customerDoaImpl文件中的服务url中,但它没有返回正确的值。我试图在服务端使用soapUI进行测试,但它正在向我的请求返回正确的数据

我正在尝试根据productId和datePeriod搜索结果 这是我的代码片段-

  url.append(getServiceUrl()).append( "/transaction/find/customerrequestv2?id={productId}&dateperiod={Dateperiod}");
服务端控制器-

    @RequestMapping(value = "/find/customerrequestv2", method = RequestMethod.GET,produces = "application/json")

  public List<Customer> CustomerRequestv2(@RequestParam(value = "id") final String pProductId,
  @RequestParam(value = "dateperiod") final String pDateperiod)
@RequestMapping(value=“/find/customerrequestv2”,method=RequestMethod.GET,products=“application/json”)
公共列表CustomerRequestv2(@RequestParam(value=“id”)最终字符串pProductId,
@RequestParam(value=“dateperiod”)最终字符串pDateperiod)

我在查询中做错了什么?

占位符
{productId}
{Dateperiod}
实际上必须用实际字符串替换,否则它将被逐字发送到服务器。例如,使用字符串格式:

String url = String.format("/transaction/find/customerrequestv2?id=%s&dateperiod=%s", productId, datePeriod);

确保您正在对查询字符串进行编码。谢谢您的快速回答。。谢谢……)如果答案回答了你的问题,你就应该投赞成票并接受它。