这个问题通常发生在Spring MVC中,表示在处理请求时无法确定请求的Content-Type,因此无法将响应数据转换为相应的格式。解决方法是在控制器方法上使用 @RequestMapping 注解,并设置 produces 属性,指定返回的 Content-Type,例如:

@RequestMapping(value = "/chat", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ChatResultVo chat(@RequestBody ChatRequestVo request) {
    // 处理请求并返回响应数据
}

这样就可以明确指定返回的 Content-Type 了。如果客户端没有指定 Accept 头部,就会以默认的方式处理。

No converter for class comdiworkintellivworkbenchiwservicechatvoChatResultVo with preset Content-Type null 是什么问题 设置 produces

原文地址: https://www.cveoy.top/t/topic/czWW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录