使用MemoryUsage获得主机内存信息问题

一直不想成为程序猿 2015-12-25 03:57:10
我是使用restful 获得json串,转成MemoryUsage对象是报错
org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: No suitable constructor found for type [simple type, class java.lang.management.MemoryUsage]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)

这个是MemoryUsage对象中没有无参构造器造成的,但这个类是jvm的jar啊,我该怎么解决啊。。

转换代码如下:
public void checkHealth(){
final String uri = "http://localhost:8080/health";

RestTemplate restTemplate = new RestTemplate();
HealthStatistics result = restTemplate.getForObject(uri, HealthStatistics.class);

System.out.println(result);
}

在线等
...全文
303 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

25,980

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧