【Spring】No converter found for return value of type: class java.util.ArrayList

时间:2018-09-09 11:56:45   收藏:0   阅读:1596

错误信息:

org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.ArrayList

如图所示:
技术分享图片

http://www.cnblogs.com/hafiz/p/5812873.html 提供了一种解决方案,似乎也是很多人的做法,但我试过之后发现不行。

后来发现是版本的问题:升了 jackson 版本后解决。
PS: 又添加了 jackson-annotations 依赖,如下:

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>

————————————————————
初始版本信息:
Spring: 5.0.7.RELEASE
jackson: 2.8.11

更改之后版本信息:
Spring: 5.0.7.RELEASE
jackson: 2.9.5

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!