报错:expect 200, but 500
来源:3-2 查询请求

taoy
2018-01-09
按照课程来写,一开始运行报 500,服务器出错,看控制台如如下输出:
Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException:
Could not write JSON: No serializer found for class com.imooc.dto.User and no properties discovered to create BeanSerializer
(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS);
nested exception is com.fasterxml.jackson.databind.JsonMappingException:
No serializer found for class com.imooc.dto.User and no properties discovered to create BeanSerializer
(to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0])
感觉应该是User类的内容都是null造成的,然后给User类的属性都赋好值(加了有参数的构造器),再放到list中就好用了,然后想再重现一下问题,把User类的属性值都设为空(就是使用无参构造器产生类),结果问题竟不能重现了,这是一种什么情况?
1回答
-
额..要看代码,看你的描述我实在想象不出来是什么问题...
112018-01-10
Spring Security技术栈开发企业级认证与授权
2662 学习 · 1561 问题
相似问题