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方法,尽量手写

相关推荐

  1. springboot请求406、500问题

    2024-01-31 00:26:01       58 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-31 00:26:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-31 00:26:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-01-31 00:26:01       87 阅读
  4. Python语言-面向对象

    2024-01-31 00:26:01       96 阅读

热门阅读

  1. DC-证书颁发机构(23国赛真题)

    2024-01-31 00:26:01       51 阅读
  2. 多语言游戏网站

    2024-01-31 00:26:01       71 阅读
  3. Bean

    2024-01-31 00:26:01       54 阅读
  4. 20240129 大模型快讯

    2024-01-31 00:26:01       66 阅读
  5. Vue2 悬浮球

    2024-01-31 00:26:01       54 阅读
  6. Springboot整合mqtt采用注解进行监听(第二篇)

    2024-01-31 00:26:01       68 阅读
  7. 2.1写一个梅林dynv6插件(上)

    2024-01-31 00:26:01       71 阅读
  8. 为什么Vue3双向绑定使用Proxy

    2024-01-31 00:26:01       71 阅读
  9. 飞往前端的第二天

    2024-01-31 00:26:01       50 阅读
  10. SpringMVC初始化源码学习

    2024-01-31 00:26:01       51 阅读
  11. Chinese and English names of 45 common character symbols

    2024-01-31 00:26:01       42 阅读