ibcdwx

  刚才支付在zookeeper注册了,现在搞个订单服务注册并去调用支付。

  1.创建模块

  2.引入依赖

  3.改配置

server:
  port: 80

# 服务别名---zookeeper注册中心名称
spring:
  application:
    name: cloud-consumer-order
  cloud:
    zookeeper:
      connect-string: 192.168.xx.xxx:2181

  4.主启动

  5.写业务

@RestController
@Slf4j
public class OrderController {

    //支付服务地址
    public static final String ZK_URL = "http://cloud-provider-payment";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/payment/zk")
    public String getpaymentInfo(){

        String returnValue = restTemplate.getForObject(ZK_URL+"/payment/zk", String.class);

        return returnValue;
    }
}

  6.测试

分类:

技术点:

相关文章:

  • 2021-12-26
  • 2022-01-06
  • 2022-01-14
  • 2022-01-27
  • 2021-07-28
  • 2021-09-18
  • 2021-11-28
  • 2022-12-23
猜你喜欢
  • 2022-01-21
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-07-29
相关资源
相似解决方案