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

后端 未结 20 2136
夕颜
夕颜 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:50

    In my case i'm using spring boot , and i have encountered a similar error :

    No converter for [class java.util.ArrayList] with preset Content-Type 'null'
    
    

    turns out that i have a controller with

    @GetMapping(produces = { "application/xml", "application/json" })
    
    

    and shamefully i wasn't adding the Accept header to my requests

提交回复
热议问题