Skip to content
Advertisement

HttpMessageNotWritableException: No converter found for return value of type: class java.util.HashMap in Spring MVC

I am trying to return a json using HashMap like this in a method in the controller

JavaScript

When I hit this method in PostMan I get this error

JavaScript

This is how I have setuped the Application

JavaScript

The error says, it cannot convert the list to httpmessges so do I need to any any converters or something like that? What am I missing something?

Advertisement

Answer

Provide @RestController in Controller class level other wise provide @ResponseBody in method level. Make sure that all jackson related jars are there in class path.

Add jackson related dependencies in to your pom.xml

JavaScript

Sample pom dependencies for jackson .

JavaScript
Advertisement