No converter found for return value of type: class com.alibaba.fastjson.JSON解决办法
默认情况下,springMVC的@ResponseBody返回的是String类型,如果返回其他类型则会报错。
使用fastjson的情况下,在springmvc.xml配置里加入:
<mvc:annotation-driven>
<mvc:message-converters
register-defaults="true">
<bean
class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json</value>
<value>application/xml;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
在pom.xml引入依赖:
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.3</version>
</dependency>
No converter found for return value of type: class com.alibaba.fastjson.JSON解决办法的更多相关文章
- 解决springmvc报No converter found for return value of type: class java.util.ArrayList问题
一.背景 最近闲来无事,想自己搭建一套Spring+SpringMVC+Mybatis+Mysql的环境(搭建步骤会在以后博客中给出),结果运行程序时,适用@ResponseBody注解进行返回Lis ...
- 解决java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList这个问题
今天使用SSM框架,用@ResponseBody注解,出现了这个问题 java.lang.IllegalArgumentException: No converter found for return ...
- 解决No converter found for return value of type: class java.util.ArrayList
十一月 02, 2018 7:37:44 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() f ...
- Idea中:No converter found for return value of type: class java.util.ArrayList:Json格式转换问题
1.在搞SSM框架的时候,前端发送请求后,显示如下错误. @ResponseBody注解进行返回List<对象>的json数据时出现 nested exception is java.la ...
- 解决java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList的问题
一.背景 最近闲来无事,想自己搭建一套Spring+SpringMVC+Mybatis+Mysql的环境(搭建步骤会在以后博客中给出),结果运行程序时,适用@ResponseBody注解进行返回Lis ...
- 解决java.lang.IllegalArgumentException: No converter found for return value of type 的问题
controller返回一个dto,并且定义了@ResponseBody注解,表示希望将这个dto对象转换为json字符串返回给前端,但是运行时报错:nested exception is java. ...
- No converter found for return value of type
springMVC请求接口的时候报500 No converter found for return value of type 原因:这是因为springmvc默认是没有对象转换成json的转换器 ...
- java.lang.IllegalArgumentException: No converter found for return value of type: class com.smart.result.Page
今天学习了一下spring boot 中的mybatis,用mybatis来增删改查用户,获取用户,添加用户,修改用户,删除用户,修改用户,都是可以的,但是获取带分页的用户列表,一直抛出这个java. ...
- 解决Spring MVC报No converter found for return value of type:class java.util.ArrayList问题
一.背景 在搭建一套Spring+SpringMVC+Mybatis(SSM)的环境(搭建步骤会在以后博客中给出),结果运行 程序时,适用@ResponseBody注解进行返回List<对象&g ...
随机推荐
- NX二次开发-UFUN由工程图视图tag获取图纸页tag UF_DRAW_ask_drawing_of_view
#include <uf.h> #include <uf_draw.h> #include <uf_drf.h> #include <uf_obj.h> ...
- P1802 5倍经验日
P1802 5倍经验日 题目背景 现在乐斗有活动了!每打一个人可以获得5倍经验!absi2011却无奈的看着那一些比他等级高的好友,想着能否把他们干掉.干掉能拿不少经验的. 题目描述 现在absi20 ...
- 去除vim ^M符号
来自: https://zhidao.baidu.com/question/267905868.html 有两种情况,会出现打开的文件都显示^M符号:1. vim被配置为fileformat=unix ...
- Codeforces 1159A A pile of stones
题目链接:http://codeforces.com/problemset/problem/1159/A 题意:初始石头堆石子数未知,求进行 n 次加减操作后,石头堆石子数最小的可能是多少. 思路:正 ...
- Git及github使用(一)客户端与本地关联
一.下载安装git客户端 1.官网下载地址:https://git-scm.com/ 2.选择自己相应的系统进行下载即可(windows一路默认安装) 二.配置git 1.在github上注册自己的账 ...
- POJ 3525 /// 半平面交 模板
题目大意: 给定n,接下来n行逆时针给定小岛的n个顶点 输出岛内离海最远的点与海的距离 半平面交模板题 将整个小岛视为由许多半平面围成 那么以相同的比例缩小这些半平面 一直到缩小到一个点时 那个点就是 ...
- Red and Black 模板题 /// BFS oj22063
题目大意: Description There is a rectangular room, covered with square tiles. Each tile is colored eithe ...
- wish - 简单的窗口式(windowing) shell
总览 wish [filename] [arg] [arg ...] 选项 -colormap new 指定窗口使用一个新的私有的调色板(colormap)而不使用给屏幕的缺省的调色板. -displ ...
- 在Spring-boot中,为@Value注解添加从数据库读取properties支持
一般我们会把常用的属性放在工程的classpath文件夹中,以property,yaml或json的格式进行文件存储,便于Spring-boot在初始化时获取. @Value则是Spring一个非常有 ...
- leetcode-241-为运算表达式设置优先级*
题目描述: 方法:分治* class Solution: def diffWaysToCompute(self, input: str) -> List[int]: if input.isdig ...