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

问题描述

解决No converter found for return value of type: class java.util.ArrayList_第1张图片

出现 No converter found for return value of type: class java.util.ArrayList 这种错误

1.原因:这是因为springmvc默认是没有对象转换成json的转换器的,需要手动添加jackson依赖。

2.解决步骤:

手动添加jackson依赖到pom.xml文件中

        <dependency>
            <groupId>com.fasterxml.jackson.coregroupId>
            <artifactId>jackson-coreartifactId>
            <version>2.11.0version>
        dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.coregroupId>
            <artifactId>jackson-databindartifactId>
            <version>2.11.0version>
        dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.coregroupId>
            <artifactId>jackson-annotationsartifactId>
            <version>2.11.0version>
        dependency>

添加完依赖之后,记得在project structure中的lib中也添加相关依赖!
解决No converter found for return value of type: class java.util.ArrayList_第2张图片

你可能感兴趣的:(解决No converter found for return value of type: class java.util.ArrayList)