Отображение моего контроллера
@GetMapping("/fetch/{one_date}/{two_date}")
public List<CourierInfo> getData_between(@PathVariable(value = "one_date") @DateTimeFormat(pattern = "yyyyMMdd") LocalDateTime fromDate, @PathVariable(value = "two_date") @DateTimeFormat(pattern = "yyyyMMdd") LocalDateTime toDate) {
return bookRepository.getData_between(fromDate, toDate);
}
Мой пользовательский запрос
@Query(nativeQuery = true, value="select c.cons_no, c.pick_date, from CourierInfo c where c.pick_date between :startDate and :endDate")
Список getData_between (@Param ("startDate") LocalDateTime date, @Param ("endDate") LocalDateTime date2) ;
Я передаю
http://localhost:8080/book_api/fetch/2020-01-20/2020-01-20
Здесь я пытаюсь получить данные между двумя датами. Я получаю эту ошибку
Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDateTime'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.web.bind.annotation.PathVariable @org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value '"2020-01-20"'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value ["2020-01-20"]