13.OpenFeign测试远程调用

以会员服务调用优惠券服务为例

引入依赖

在之前创建微服务模块时已经引入了这个依赖,就不需要重复引入了

添加要被member微服务调用的coupon微服务的coupon的方法

在member微服务添加一个接口用于远程调用

在member微服务开启远程调用功能

在member微服务Controller写一个方法测试下

 先直接调用coupon微服务的info方法看下结果:

 调用member微服务的test方法,test方法远程调用coupon微服务的info方法:

 成功了

posted @ 2023-02-24 23:57  lucsa  阅读(52)  评论(0编辑  收藏  举报