no suitable constructor found, can not deserialize from Object value (missing default constructor or

spring cloud 运行中,启动了provider,再启动了consumer,然后在consumer中向provider发送请求报错:

2017-04-27 09:34:23.234  WARN 2176 --- [nio-7900-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Can not construct instance of com.sino.cloud.entity.User: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: java.io.PushbackInputStream@5f26848a; line: 1, column: 3] (through reference chain: java.lang.Object[][0]);


这个错误的起源是因为我做测试,没有使用数据库,在findAll()方法里直接循环new的user对象,所以报错找不到合适的user对象的构造,这是检查我的user类中,我是有含参构造,然后由于错误是400,所以我加入了无参构造,都加,然后重新运行请求,正常!

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值