.HttpMessageNotWritableException: No converter found for return value of type: class xxx.Xxx

it2026-03-03  1

今天使用@ResponseBody注解返回一个自己封装的message对象结果就包如下错误

org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class xxx.Xxx

网络真是无奇不有,得找到问题的实质 一直在说是fastjson的jar包没导入,可我创建项目就导入了呀 在一个就是类中没有添加 set 和 get方法我每次写完类必须alt+ins,这是习惯 还有改类的 说这么多就是为一句 问题的实质 最后终于解决:jar包没导全啊哈哈

<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.41</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.10.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.10.2</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.10.2</version> </dependency>

感谢博主:TianXin1432516744

最新回复(0)