先把报错日志贴出来:
Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.test.dto.ResultBean]
如果日志类似可以继续往下看。
1. 问题原因和处理
先还原事故现场(只展示核心问题代码)
接口层代码:
@RestController
@RequestMapping("/client")
public class ControllerTest {
@GetMapping("/test")
public ResultBean name() {
return ResultBean.success();
ResultBean 代码:
public class ResultBean {
private String code;
private String result;
ResultBean(String code, String result) {
this.code = code;
this.result = result;
public static ResultBean success() {
return new ResultBean("200", "success");
出错日志指向了这个 ResultBean,大概率就是这个 bean 有问题,仔细分析那个日志,大概意思是没法获取值导致没法写,获取值?get方法?好像,ResultBean 确实少了get方法(lombok注解忘了),加上 get 方法试一试,问题果然解决了....
Tips:一定要加 get、set方法,尽量手写;lombok 注解少用,这里面有坑,偶尔特殊字段生成的默认方法没办法被其他组件识别。
前言:先把完成的报错(应该算是警告日志)贴出来:Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class com.test.dto.ResultBean]如果日志类似可以继续往下看。1. 问题原因和处理先还原事故现场(只展示核心问题代码)接口层代码:@RestController
文件下载接口报错:httpMessageNotWritableException: No converter for [xxx] with preset Content-Type ‘xxx‘
1. 问题描述
在写SpringBoot项目的时候,由于是前后端分离项目,为了统一接口形式,使用一个类封装了返回数据的形式,但是在测试的时候报异常HttpMessageNotWritableException
后续附上解决办法(有些时候看上去一头雾水的bug可能只是一个很小的问题 so不要放弃~!)
封装类的代码:
1 package com.xiaobai.realt...
The type org.springframework.dao.DataAccessException cannot be resolved. It is indirectly referenced from required .class files
解决方法:
导入spring-tx-4.2.2.RELEASE.jar包。
HttpMessageNotWritableException: Could not write JSON: [no message for java.lang.ArrayStoreException]前言一、问题描述二、实体类如下三、解决方式总结
最近做一个需求,几个表单的增删改查功能。由我和另外一个同事共同完成功能。在使用@Validated和@NotBlank作参数校验时遇到了一个令人头疼的问题
一、问题描述
保存功能的参数校验在本地测试没有任何问题,发布到线上后,就报错
org.sprin
问题现场还原
最近研发过程中,后台代码是这么写的:
@ApiImplicitParam(name = "X-Token", value = "登陆用户Token",required = true, dataType = "String",paramType="header")
@PostMapping(value = "/update-advert-status.do")
public VueElementAdminResponse updateAdvertStatus(@Reque
如果你想关闭 Spring Boot 的统一异常处理,可以在 `@SpringBootApplication` 注解所在的类中添加 `exclude = ErrorMvcAutoConfiguration.class`,示例如下:
```java
@SpringBootApplication(exclude = ErrorMvcAutoConfiguration.class)
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
这样就禁用了 Spring Boot 默认的异常处理机制。注意,这样做会导致 Spring Boot 不再提供默认的错误页面和异常信息,需要自己实现异常处理和错误页面。
The server selected protocol version TLS10 is not accepted by client preferences [TLS12] 报错处理
32075
The server selected protocol version TLS10 is not accepted by client preferences [TLS12] 报错处理
walterchen2023:
SpringBoot 接口同时接收MultipartFile参数和结构体参数
DeveloperYancc:
mybatis 传入Integer类型0时导致参数丢失
djyjava:
The server selected protocol version TLS10 is not accepted by client preferences [TLS12] 报错处理
麻雀也会逆风飞翔:
The server selected protocol version TLS10 is not accepted by client preferences [TLS12] 报错处理
qq_29185915: