这个只需修改一个地方就可以了,在接口的注解上一个produces =MediaType.APPLICATION_PROBLEM_JSON_VALUE即可
@RequestMapping(value = "save",produces =MediaType.APPLICATION_PROBLEM_JSON_VALUE)
public Map<String,String> save(Integer id){
Map<String,String> result=new HashMap<>();
ResponseEntity<Product> response = restTemplate.getForEntity("http://product-service/api/product/findById?id=" + id, Product.class);
System.out.println(response);
result.put("code","1");
result.put("data","success");
result.put("message","订单提交成功");
result.put("product_name","");
return result;
}
我看了一个别人写过的blog,他说需要添加其他jar包在pom文件中,但是我没有加就可以了,不过处理这个问题是受他的启发,
所以这里贴一下这个兄台的链接,如果想看的话可以点击查看一下
https://blog.csdn.net/Hmily_hui/article/details/82994868