Failed to convert value of type ‘java.lang.String‘ to required type ‘java.util.Date‘;

Report 400: data type mismatch:

    The type of time passed in the path URL is string

    You can add this annotation in the controller layer to convert string to java.util.date

    @DateTimeFormat(pattern = "yyyy-MM-dd") Date begin
    
       @GetMapping
          public List<Demand> listAll(@RequestParam("begin") @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam("end") @DateTimeFormat(pattern = "yyyy-MM-dd")Date endTime){
              System.out.println("beginTime"+beginTime);
              System.out.println("endTime:"+endTime);
              return demandClient.queryAllDemands(beginTime, endTime);
          }
      

      date begintime in the figure; If the front-end parameter is not begintime but begin, it needs to be defined as begin. in @ requestparam

      Read More: