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

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

    In my case, I was returning Boolean in Response Entity and had :

    produces = MediaType.TEXT_PLAIN_VALUE,
    

    When i changed it to below

    produces = MediaType.APPLICATION_JSON_VALUE
    

    It worked!

    Example of what i had.

    @PostMapping(value = "/xxx-xxxx",
                produces = MediaType.APPLICATION_JSON_VALUE,
                consumes = MediaType.APPLICATION_JSON_VALUE)
        public ResponseEntity yyyy(
    

提交回复
热议问题