SpringBoot project Could not find acceptable representation solution

Full information:

WARN 20144 — [0.0-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]

reason:

The object returned by the Controller method has no get method, and the object cannot be converted to JSON

Solution:

Add the get method, and the attributes with the get method will be converted into JSON

You can use the lombok library to annotate @Data or @Getter on the class

Guess you like

Origin blog.csdn.net/Cey_Tao/article/details/127835909