0%

Springboot报错:No converter found for return value of type: class

调用springboot的api接口时,报错如下:

1
2
3
WARN 12573 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to write HTTP message: 
org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of
type: class gy.finolo.common.Response

No converter found for return value of type: class gy.finolo.common.Response

主要原因是gy.finolo.common.Response这个自定义类中的属性,少了getter方法。

在这个类里面,自动生成getter方法就可以了,当然最好也把setter也生成出来。