报错截图:

170616、解决 java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList

 

原因:搭建项目的时候,springmvc默认是没有对象转换成json的转换器的,需要手动添加jackson依赖。

解决步骤:

1、添加jackson依赖到pom.xml

        <!-- jaskson -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.5.4</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.5.4</version>
        </dependency>        

2、在springmvc.xml增加

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

然后问题解决

170616、解决 java.lang.IllegalArgumentException: No converter found for return value of type: class java.util.ArrayList

 

相关文章:

  • 2021-08-08
  • 2021-12-10
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2021-03-30
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2021-11-21
  • 2022-01-19
  • 2022-12-23
  • 2022-03-02
  • 2021-10-12
相关资源
相似解决方案