微服务中,消费者调用restTemplate.postForObject(), 生产者要在接收的参数中加入@RequestBody的原因
是因为restTemplate.postForObject()是将参数包装成一个整体的形式
但如果直接调用,
@RequestMapping(value = "/payment/create") public CommonResult create( Payment payment){ int result=paymentService.create(payment); log.info("插入成功"+ result); System.out.println("PaymentController "+payment.getSerial()); if(result>0){ return new CommonResult(200, "success", result); }else{ return new CommonResult(444, "failed", null); } }
则不应该在payment面前加入@RequestBody注解