0
点赞
收藏
分享

微信扫一扫

前后端传递时间参数偶遇参数类型转换异常

sin信仰 2022-07-18 阅读 59


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]

前后端传递时间参数偶遇参数类型转换异常_java

前后端传递时间参数偶遇参数类型转换异常_java_02

这次粗心大意,刚刚实习就展现了许多低级错误,

首先参数类型错误 没有看清到底是LocalDateTime还是LocalTime

之前的代码是错的 本次业务分页查询 + 条件查询,注意空指针异常尤其是刚开始打开页面没有传入任何参数的时候容易报空指针,时间参数做好判断

前后端传递时间参数偶遇参数类型转换异常_spring_03


举报

相关推荐

后端参数校验以及校验异常处理

0 条评论