解决在Spring MVC开发中No converter found for return value of type的问题。
问题如图:
解决方案:1、加上jackson依赖。
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.9</version>
</dependency>
2、在Spring MVC配置类上加上@EnableWebMvc注解,代码如下
@Configuration
@ComponentScan("com.xiaoxie.controller")
@EnableWebMvc
public class ServletConfig {
}
解决完之后重新启动就可以了。