使用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)
原因是缺少構造函數、或者定義了有參構造函數、沒定義無參構造函數