Over a million developers have joined DZone.

Spring Boot RestController Error: “No Converter Found for Return Value of Type”

DZone's Guide to

Spring Boot RestController Error: “No Converter Found for Return Value of Type”

Have you come across this error? Let's take a look at how this happens and how public getters are one possible solution to the problem.

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

Spring Boot RestControllers, by default, can return a POJO class as the return result from a mapped request method, and it is converted into a JSON result. I’ve run into this issue before though, and it’s not immediately obvious what’s wrong: ‘No converter found for return value of type’:

java.lang.IllegalArgumentException: No converter found for return value 
of type: class kh.springboot.redis.domain.RedisResult
at org.springframework.web.servlet.mvc.method.annotation
.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:187) ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE]

My returned class from my @GetMapping method is just a simple POJO:

public class RedisResult {

    private String key;
    private String value;

    public RedisResult(String key, String value) {
        this.key = key;
        this.value = value;

And my @RestController is a simple controller with a single @GetMapping (in this case I’m building a REST endpoint to query key values from Redis using Spring Data Redis RedisTemplate:


public class RedisRestController {

    private RedisTemplate template;

    public RedisResult getSingleValue(@PathVariable("key") String key){
        String value = (String)this.template.opsForValue().get(key);
        RedisResult result = new RedisResult(key, value);
        return result;

If you’ve found my post because you have this same issue, before you go down the rabbit hole adding additional Maven dependencies or additional annotations you think might be missing, the reason is usually that the POJO class you are returning doesn’t have any public getter methods. For each property in your POJO that you want returned in your JSON, make sure you have a public getter.

This is discussed in this StackOverflow post here.

Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. 

java ,tutorial ,spring boot errors

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}