【Spring】HttpMessageNotWritableException No converter found for return value of type
1.背景
Spring boot 启动报错
Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.LinkedHashMap
出现以上错误,原因在于,缺少了springmvc进行json转换需要的jar包,引入对应jar依赖:
<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.9.6</version>
</dependency>
<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>2.9.6</version>
</dependency>
<dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.9.6</version>
</dependency>
另外在pom文件中如果引入springboot-web依赖排除掉了springboot-web自带的json也会导致上面的异常信息:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId><exclusions><exclusion><artifactId>spring-boot-starter-json</artifactId><groupId>org.springframework.boot</groupId></exclusion></exclusions>
</dependency>
此时,需要将依赖改为以下即可:
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId>
</dependency>
https://blog.csdn.net/cnd2449294059/article/details/104216291
【Spring】HttpMessageNotWritableException No converter found for return value of type相关推荐
- HttpMessageNotWritableException: No converter found for return value of type,可能出现的原因及解决方法
首先,演示一下出现的情况,创建一个实体类,代码如下: public class User2 {private Long id;private String username;public User2( ...
- SpringBoot:HttpMessageNotWritableException: No converter found for return value of type
网上搜了一圈,总结一下出现上述问题的主要原因: 未写报错的类相应属性的:setter.getter 缺少jackson包支撑:类对象 -> Json数据格式的转换 对于1中出现的问题,请仔细检查 ...
- No converter found for return value of type: class xxx(自定义的class对象)
先贴一份异常信息: org.springframework.http.converter.HttpMessageNotWritableException: No converter found for ...
- JavaWeb项目中出现No converter found for return value of type的解决方法
目录 异常展示: 解决方法 原理: 拓展 异常展示: 意思就是找不到返回值类型的转换器,其实就是你的controller在进行json数据返回的时候,找不到进行json数据转换的转换器.我这里使用的是 ...
- SpringBoot 封装返回类报错:No converter found for return value of type
封装完毕Result返回类,使用PostMan测试时报错 {"timestamp": "2020-06-03T10:38:03.144+0000"," ...
- java统一返回结果集封装,解决No converter found for return value of type
网上很多,自己参照手写了一个. package com.***.pro.utils;/*** @Author: wsh*/public class Result<T> {private B ...
- 【Spring】框架简介
[Spring]框架简介 Spring是什么 Spring是分层的Java SE/EE应用full-stack轻量级开源框架,以IOC(Inverse Of Control:反转控制)和AOP(Asp ...
- 【Spring】23、ApplicationContext ,ApplicationContextAware,Listener,Event 的关系解读
tomcat容器启动流程 启动tomcat容器,加载web.xml,建立整个容器(Servlet容器,这里是tomcat吧)的上下文,ServletContext,这时web.xml有个监听器,就是C ...
- 【Spring】Spring高级话题-@Enable***注解的工作原理
@EnableAspectJAutoProxy 前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. @EnableAspectJAutoProxy注解 ...
最新文章
- 用PHP生成等比图像的方法
- 1.8 为什么是人的表现-深度学习第三课《结构化机器学习项目》-Stanford吴恩达教授
- 吃糖果(HDU-1205)
- xStream:Security framework of XStream not initialized, XStream is probably vulnerable.
- Solr部分更新MultiValued的Date日期字段时报错及解决方案:Invalid Date String:‘Mon Sep 14 01:48:38 CST 2015‘
- 【GIS】GIS概念
- 大教堂与集市 The Cathedral The Bazaar -- 这是当代软件技术领域最重要的著作
- Linux系统重要日志文件
- 《算法设计与分析》王红梅 第二版部分习题
- MapGIS基础开发环境搭建(IGSserver的安装、开发人员资格申请)
- vue中pdf预览组件_基于vue的pdf预览组件
- python3在线编程工具_9种方便的在线IDE(可在线编辑并运行代码)
- 电商系统PC商城模块介绍
- 计算机电源功率高好吗,电脑电源买多大功率适合?实战分析分享
- KEIL工程文件打不开
- ios 自带录屏框架replayKit的使用
- 奇幻文学的鼻祖、善与恶的经典战争 《魔戒三部曲》[英]J.R.R.托尔金
- kinhdown稳定版无法连接服务器,KinhDown稳定版
- JScript 方法
- 计算机算法——进入计算机世界
热门文章
- 黑鲨4游戏手机开启预热:4>5+6+7 比竞品更胜一筹
- 滴滴:女乘客性骚扰男司机一事属实 已对该乘客永久封禁
- 蚂蚁战配基金已售罄两只 累计关注人数超500万
- 阿里巴巴港股股价创历史新高 市值超6.1万亿港元
- 魅族17将配备GaN氮化镓充电器:快充安全又高效
- 三星Galaxy S20系列机模上手视频曝光:不再单独设置Bixby按键
- 2799元起!小米CC9 Pro正式开售:1亿像素加持DXOMark总分第一
- vivo NEX 3新爆料:或预装Funtouch OS 9.1
- 苹果为什么收购英特尔手机基带业务?库克解释了一下
- 罗永浩谈乔纳森离职:乔布斯才是苹果的灵魂设计师