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)

使用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)

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

posted @ 2020-03-15 01:48  复一日  阅读(3017)  评论(0编辑  收藏  举报