Marc Marc - 3 months ago 14
Java Question

java.lang.IllegalArgumentException: No converter found for return value of type

With this code

@RequestMapping(value = "/bar/foo", method = RequestMethod.GET)
public ResponseEntity<foo> foo() {

Foo model;
...
return ResponseEntity.ok(model);
}
}


I get the following exception

java.lang.IllegalArgumentException: No converter found for return value of type


My guess is that the object cannot be converted to JSON because Jackson is missing. I don't understand why because I thought that Jackson was built in with spring boot.

Then I have tried to add Jackson to the pom.xml but I still have the same error

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.3</version>
</dependency>


Do I have to change any spring boot properties to make this work?

Thank you

Answer

The problem was that one of the nested objects in Foo didn't have any getter/setter

Comments