今天遇到的一个问题,经多番查找发现是缺少json的jar包
No converter found for return value of type: class java.util.HashMap:Exception org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.HashMap
@ResponseBody注解标识该方法的返回值直接写回到HTTP响应体中去(而不会被被放置到Model 中或被解释为一个视图名),因此这里需要引入jar包,给出maven依赖:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.6</version>
</dependency>