使用RestTemplate对象访问请求出错

@GetMapping(value = "/consumer/dept/get/{id}")
    public Dept get(@PathVariable Long id){
        return restTemplate.getForObject(REST_URL_PREFIX+"/dept/get/"+id,Dept.class);
    }

Cannot construct instance of com.jty.entities.Dept (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
Cannot construct instance of `com.jty.entities.Dept` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

Cannot construct instance of `com.jty.entities.Dept` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)

原因是缺少构造函数、或者定义了有参构造函数、没定义无参构造函数

相关文章:

  • 2021-05-14
  • 2021-11-16
  • 2021-08-19
  • 2021-06-19
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
猜你喜欢
  • 2021-06-09
  • 2021-08-04
  • 2022-12-23
  • 2021-08-01
  • 2022-12-23
  • 2022-02-06
  • 2021-10-20
相关资源
相似解决方案