在我使用时间格式的Date传递参数时:会出现以下错误:
- Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type
错误的意思就是说:controller需要的是Date类型的,但是传过来的参数时string类型的。为了解决这样的问题,再项目中添加如下代码:
将注释部分打开:
再来请求时间参数: