当前位置: 代码迷 >> 综合 >> No converter found for return value of type: class java.util.ArrayList(json数据转换错误)
  详细解决方案

No converter found for return value of type: class java.util.ArrayList(json数据转换错误)

热度:37   发布时间:2023-12-17 07:06:52.0

1.在pom.xml添加依赖

<!-- jackson --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.8.5</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.8.5</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>2.8.5</version></dependency>

2.在springmvc中添加配置

<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>

 

  相关解决方案