首页 > 其他分享 > springboot 全局 Date参数接收 String格式 转换异常报错

springboot 全局 Date参数接收 String格式 转换异常报错

时间:2023-03-10 14:35:12浏览次数:44  
标签:10 00 springboot 03 parse 报错 2023 Date

JSON parse error: Cannot deserialize value of type `java.util.Date` from String \"2023-03-10 10:00:00\": not a valid representation (error: Failed to parse Date value '2023-03-10 10:00:00': Cannot parse date \"2023-03-10 10:00:00\": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSZ', parsing fails (leniency? null)); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.util.Date` from String \"2023-03-10 10:00:00\": not a valid representation (error: Failed to parse Date value '2023-03-10 10:00:00': Cannot parse date \"2023-03-10 10:00:00\": while it seems to fit format 'yyyy-MM-dd'T'HH:mm:ss.SSSZ', parsing fails (leniency? null))\n at [Source: (PushbackInputStream); line: 3, column: 18] (through reference chain: com.example.springboot.domain.OrderDto[\"createDate\"])     需要加上配置:

#时区,默认为格林尼治时间,即少8小时,所以我们需要+8
spring.jackson.time-zone=GMT+8
#时间格式转换定义
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss

标签:10,00,springboot,03,parse,报错,2023,Date
From: https://www.cnblogs.com/tiancai/p/17203231.html

相关文章

  • Python - pip 报错记录
    #安装包出现错误$pipinstall-rrequirements.txt-ihttp://pypi.douban.com/simple/ERROR:Couldnotfindaversionthatsatisfiestherequirementpbr(from......
  • mongdb.driver UpdateOptions参数解析
    在.NETMongoDB.Driver中,UpdateOptions类是MongoDB集合中更新操作的参数选项类。该类包含以下常用属性:IsUpsert:是否执行upsert操作。如果设置为true,表示文档不存......
  • sdkconfig报错
    2023-03-0910:45:22问题描述:打开软件Espressif-IDE,编译示例blink通过,打开sdkconfig报错,如下图。解决方法:卸载干净,重新安装最新版本5.0.1  控制面板卸载ESP-IDFTo......
  • 如何解决"代码依赖分析,可能会导致对应文件无法加载"的引用报错问题
    一、问题现象:uni-app开发小程序微信开发工具报:Error:xxx.js 已被代码依赖分析忽略,无法被其他模块引用。你可根据控制台中的【代码依赖分析】告警信息修改代码,或关闭......
  • datetime模块
    相比time模块,datetime模块的接口更直观,更容易调用datetime模块定义了下面几个类:datetime.date表示日期的类,常用的属性有year,month,day;datetime.time表示时间的类......
  • opengauss集群安装报错
    DB_VERSION:opengauss3.0.31.[GAUSS-51632][GAUSS-51632]:Failedtodogs_sshexkey.Error:Pleaseenterpasswordforcurrentuser[root].Error:Failedtoreg......
  • IDEA 启动 Spring Boot 时报错: Command line is too long
    当新拉取的项目启动时,报Errorrunning'MyApplication':Commandlineistoolong.ShortencommandlineforMyApplicationoralsoforSpringBootdefaultconfigur......
  • springboot-整合mysql多数据源配置
    一、springboot+mybatis使用分包方式整合1、application.yml配置文件server:port:8080#启动端口spring:datasource:db1:#数据源1jdbc-url:j......
  • IDEA中使用JDBC连接MySQL数据库报错:No appropriate protocol (protocol is disabled o
    在IDEA中使用JDBC连接MySQL,程序运行之后报错:  定位到第16行:  根据上面报错提示,在url参数字段最前面添加参数 useSSL=false :  再次运行程序,成功连接到......
  • DOTNET CORE DATETIME在LINUX与WINDOWS时间不一致
    .netcore项目,部署到CentOS上的时候,发现DateTime.Now获取的时间与Windows不一致,主要是时区不一致。staticvoidMain(string[]args){Console.WriteLine(DateTime.......