Failed to convert from type [java.lang.String] to type [@io.swagger.annotations.ApiParam @org.sprin

完整错误: Failed to convert from type [java.lang.String] to type [@io.swagger.annotations.ApiParam @org.springframework.web.bind.annotation.RequestParam java.util.Date

如果是请求参数,请加注解:@DateTimeFormat(pattern = "dd-MM-yyyy") 

@GetMapping(value = SUMMARY_URL, produces = "application/json")
public DailyReportSummary getSummaryOfDailyReports(
        @RequestParam(name = "from", required = false, defaultValue = "10-10-2017") @DateTimeFormat(pattern = "dd-MM-yyyy") LocalDate from,
        @RequestParam(name = "to", required = false, defaultValue = "10-10-2019") @DateTimeFormat(pattern = "dd-MM-yyyy") LocalDate to) {
    

 

你可能感兴趣的:(异常处理)