简体   繁体   中英

How to debug 406 not acceptable error in java application using spring

My code is using spring boot and java but while testing a method it is showing 406 not acceptable error how to debug??

406 Not Acceptable

The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.

So, probably your request accept header is different then your controller's produce type (application/json, text/json etc). This happens when the correct HTTPMessageConverter can not be found to satisfy the @ResponseBody annotated return value.

Please provide your controller you are testing and test case

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM