原因分析

根据异常提示:不匹配输入异常,指输入的参数错误,说是只支持String类型和Array数组类型的。

@PostMapping("/test")
public Dto getWindStorageOutputPower(@ApiIgnore @RequestBody @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate localDate) {
System.out.println(localDate);
return null;
}

修改:

将输入参数改为String类型的日期。比如 2021-06-04;或者将@RequestBody改为@RequestParam。

其他场景

  • 如果接受前端的是实体类,日期为实体中的一个属性,需要将@DateTimeFormat加到成员变量上,而不是在方法参数中

@RequestBody中使用@DateTimeFormat报错:JSON parse error: Expected array or string.; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException的更多相关文章

  1. JSON parse error: Cannot deserialize instance of `int` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc

    代码程序: @PostMapping("selectById") @ResponseBody public Result selectById(@RequestBody int i ...

  2. JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of j

    异常信息如下: JSON parse error: Can not deserialize instance of java.lang.String out of START_OBJECT token ...

  3. HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite

    org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite r ...

  4. [待解决]报错:JSON parse error: Unexpected character

    {"code":"9999","message":"JSON parse error: Unexpected character ...

  5. 记一次接口调试错误: {"timestamp":"2019-09-11T03:04:30.036+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Object is null; nested exception is com.fasterxml.jackson

    接口测试中用postman测试返回是正常的,但是使用其他人去调用就出错了,找了半天,才想起来使用了nginx,用于端口的代理转发.然后根据错误信息发现json格式的某个字段为null,结合日志中的报文 ...

  6. 页面白屏并且报错PHP Parse error: syntax error, unexpected end of file in 试了很久总算解决了

    页面白屏并且报错PHP Parse error:  syntax error, unexpected end of file in 试了很久 啥短标记,打开,都试了 最简单的办法 是重新建立一个文件, ...

  7. jackson json转实体对象 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

    Jackson反序列化错误:com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field的解 ...

  8. Docker报错“Dockerfile parse error line 1: FROM requires either one or three arguments”

    看官方文档Format: 以 '#' 开头一行被视为评论,出现在其他位置视为参数. 也就不难理解报错原因:将写在同一行的注释视为参数了. 原Dockerfile: 改为:

  9. TP5报错variable type error: array

      variable type error: array 当你在tp5框架中写方法时返回一个数组时,tp5会报错:variable type error: array 这是因为tp5不支持返回数组. ...

  10. jackson json转实体 com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException

    jackson 2.2.2 由于vo中缺少json的某个字段属性引起 2种解决方法 1:vo中添加注解@JsonIgnoreProperties(ignoreUnknown = true) 2.  m ...

随机推荐

  1. PPT 动画-多层旋转(圆角三角形)

    多层旋转动画 插入若干个三解形 然后将页面切换成[平滑](Office 2019~ 365 才有这功能,或者 iSlide 平滑过渡)

  2. MongoDB 占用CPU资源过高

    情况如下 db.currentOp() 发现有全表扫描 将 Collscan 对应的 Collection 建索引 db.Table1.createIndex({"DataTime" ...

  3. python实现微信扫码支付

    import datetime import hashlib import time import json import random import string import requests f ...

  4. 【django-vue】主页前端搭建 git介绍和安装 git工作流程 git常用命令 git过滤文件 重写drf方法 跨域中间件 导出项目依赖

    目录 上节回顾 1 主页前端 Header组件 Banner组件 Footer组件 2 git介绍和安装 git和svn比较 pycharm中配置git svn,git ,github,gitee,g ...

  5. 10.4K Star!程序员为程序员针对性优化的开源免费笔记

    平时我一直用Notion来记录内容为主,但也一直关注着其他开源产品.上周正好看到一款非常受欢迎的开源免费笔记,今天就推荐给大家:VNote. VNote一个由程序员为程序员打造的开源笔记应用,基于Qt ...

  6. C#9.0:Improved Pattern Matching

    增强的模式匹配 C#9.0添加了几种新的模式.我们可以参阅模式匹配教程 ,来了解下面代码的上下文: 1 public static decimal CalculateToll(object vehic ...

  7. AtCoder Beginner Contest 211 (C ~ E) 个人题解

    比赛链接:Here A.B题跳过 C - chokudai 题意: 给出一个字符串,问有多少个字串能构成 chokudai 这道题算是一个简单DP,只要计算某个位置对构成 chokudai 的贡献值即 ...

  8. plsql打开报错:Control 'dxDockBrowserPanel' has no parent window问题解决

    一.现象: 使用plsql登陆oracle数据库时,登陆信息没有报错,但是最后一步报错,重启电脑依然没有解决 一直报:" Control 'dxDockBrowserPanel' has n ...

  9. kubernetes 资源管理概述

    本文转载自 Cizixs 的博客 kubernetes 资源管理概述 kubernetes 资源简介 什么是资源? 在 kubernetes 中,有两个基础但是非常重要的概念:node 和 pod.n ...

  10. 每天学五分钟 Liunx 101 | 存储篇:LVM

    LVM LVM(Logical Volume Manager),逻辑卷管理器.一种高级文件系统管理方式,它可以动态扩展文件系统.   LVM 的示意图如下所示: