您的位置:首页 > 产品设计 > UI/UE

java.lang.IllegalArgumentException: No converter found for return value of type: class

2016-06-01 11:43 916 查看
原文地址http://stackoverflow.com/questions/33832735/spring-boot-application-no-converter-found-for-return-value-of-type

原因:请求返回的数据无法转换,需要添加如下配置

1.在pom.xml 里添加

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.3</version>
</dependency>

2.在spring-mvc 配置文件添加下面的配置,不使用默认的配置
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter" />
<bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
</mvc:message-converters>
</mvc:annotation-driven>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: