缺少服务器异常 Spring Boot

MissingServelException SpringBoot

我在 Spring 启动时遇到错误,它说我没有发送 paramSelect 但它是错误的,我发送了 paramSelect.

我发

 public filterResult(paramSelect: string, filterDateStart: string, filterDateEnd: string): Observable<any> {
  filterDateStart = filterDateStart.replace(/\//g, '-');
  filterDateEnd = filterDateEnd.replace(/\//g, '-');

const url = 'http://localhost:8080/filterResult/' + paramSelect + '/' + filterDateStart + '/' + filterDateEnd;
return this.http.get<any>(url);

Html 错误->

zone.js:2969 GET http://localhost:8080/filterResult/EDU/04-07-2018/05-07-2018 400 ()

在我的Spring引导->

@RequestMapping(method = RequestMethod.GET, value = "/filterResult/{paramSelect}/{dateStart}/{dateEnd}", produces = MediaType.APPLICATION_JSON_VALUE)
public List filterResult(@RequestParam("paramSelect") String  paramSelect , @RequestParam("dateStart") String dateStart , @RequestParam("dateEnd") String dateEnd) {
    System.out.println("llego");
    List<Parameter> list = pgService.filterResult(paramSelect, dateStart, dateEnd);
    return list;
}

我收到一个错误:

Resolved exception caused by Handler execution: org.springframework.web.bind.MissingServletRequestParameterException: Required String parameter 'paramSelect' is not present

对于 path 变量,您应该更改为使用 @PathVariable 而不是 @RequestParam

 public List filterResult(@PathVariable("paramSelect") String  paramSelect , @PathVariable("dateStart") String dateStart , @PathVariable("dateEnd") String dateEnd) {