0


springboot请求406、500问题

请求406

2024-01-29 09:19:00 [http-nio-18811-exec-1] WARN  org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolved [org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation]

解决

在类上加注解@RestController,在方法上加注解@ResponseBody
@PostMapping(path = “/upload”, produces=“application/json;charset=utf-8”)

请求500

2024-01-29 16:11:35 [http-nio-18811-exec-1] WARN  org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class com.*.model.entity.BaseRsp] with preset Content-Type 'null']

没法获取值导致没法写
要加 get、set方法,尽量手写

标签: spring boot java

本文转载自: https://blog.csdn.net/naruto227/article/details/135915413
版权归原作者 naruto227 所有, 如有侵权,请联系我们删除。

“springboot请求406、500问题”的评论:

还没有评论