406 not acceptable (unable to receive exception) exception --springboot project login

406 not acceptable (unable to receive exception) exception – springboot project login

Record a small but not small problem. When logging in to the springboot project, I want to return the data in the background to the front end in the form of an R object. The attributes in the R class are: troubleshooting: break point
insert image description here,
point a little to troubleshoot
insert image description here

After many attempts: I found that the data can still be found out, so I first returned an object data without R class.
insert image description hereIn fact, the data can still be transmitted to the front end, so I judged that it must be wrong when the R class data was transmitted. With the fastjson dependency, springboot will automatically convert the object into json and transmit it to the front end.

Reason for the error: It is because I added the annotation @Data less , resulting in no setter and getter methods being generated, and the object cannot be automatically converted into json data . As a result, when the backend transmits data to the frontend, such data cannot be received, and error 406 is unacceptable abnormal!

Guess you like

Origin blog.csdn.net/qq_44627822/article/details/126573389