前后端传递时间参数偶遇参数类型转换异常
org.springframework.web.method.annotation.MethodArgumentTypeMismatchException:
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.RequestParam @org.springframework.format.annotation.DateTimeFormat java.time.LocalDateTime] for value ‘2019/10/24 14:42:04’; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [2019/10/24 14:42:04]
這次粗心大意,剛剛實習就展現了許多低級錯誤,
首先參數類型錯誤 沒有看清到底是LocalDateTime還是LocalTime
之前的代碼是錯的 本次業務分頁查詢 + 條件查詢,注意空指針異常尤其是剛開始打開頁面沒有傳入任何參數的時候容易報空指針,時間參數做好判斷
總結
以上是生活随笔為你收集整理的前后端传递时间参数偶遇参数类型转换异常的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL数据库查询时间段的两种方法
- 下一篇: 有nativeQuery = true和