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

后端 未结 20 1871
夕颜
夕颜 2020-11-30 00:04

With this code

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

        Foo model;
        ...         


        
相关标签:
20条回答
  • 2020-11-30 00:58

    I saw the same error when the scope of the jackson-databind dependency had been set to test:

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.9</version>
        <scope>test</scope>
    </dependency>
    

    Removing the <scope> line fixed the issue.

    0 讨论(0)
  • 2020-11-30 01:02

    The issue occurred in my case because spring framework couldn't fetch the properties of nested objects. Getters/Setters is one way of solving. Making the properties public is another quick and dirty solution to validate if this is indeed the problem.

    0 讨论(0)
提交回复
热议问题