607的彩的正确网址

现在的位置: 607的彩的正确网址 > 云计算 > 正文

Feign是什么?Feign能做什么?

2020年02月14日 云计算 ⁄ 共 2816字 ⁄ 字号 评论关闭

  一、Feign是什么?

  feignshiyigeshengmingshiwebservicekehuduan。shiyongfeignnengrangbianxieweb servicekehuduangengjiajiandan, tadeshiyongfangfashidingyiyigejiekou,ranhouzaishangmiantianjiazhujie,tongshiyezhichijax-rsbiaozhundezhujie。feignyezhichikebachashidebianmaqihejiemaqi。spring cloudduifeignjinxinglefengzhuang,shiqizhichilespring mvcbiaozhunzhujiehehttpmessageconverters。feignkeyiyueurekaheribbonzuheshiyongyizhichifuzaijunheng。

607的彩的正确网址  feignshiyigeshengmingshidewebfuwukehuduan,shidebianxiewebfuwukehuduanbiandefeichangrongyi,zhixuyaochuangjianyigejiekou,ranhouzaishangmiantianjiazhujiejike。

  二、Feign能做什么?

  feignzhizaishibianxiejava httpkehuduanbiandegengrongyi。

607的彩的正确网址  qianmianzaishiyongribbon+resttemplateshi,liyongresttemplateduihttpqingqiudefengzhuangchuli,xingchengleyitaomobanhuadediaoyongfangfa。danshizaishijikaifazhong,youyuduifuwuyilaidediaoyongkenengbuzhiyichu,wangwangyigejiekouhuibeiduochudiaoyong,suoyitongchangdouhuizhenduimeigeweifuwuzixingfengzhuangyixiekehuduanleilaibaozhuangzheixieyilaifuwudediaoyong。suoyi,feignzaicijichushangzuolejinyibufengzhuang,youtalaibangzhuwomendingyiheshixianyilaifuwujiekoudedingyi。zaifeigndeshixianxia,womenzhixuchuangjianyigejiekoubingshiyongzhujiedefangshilaipeizhita(yiqianshidaojiekoushangmianbiaozhumapperzhujie,xianzaishiyigeweifuwujiekoushangmianbiaozhuyigefeignzhujiejike),jikewanchengduifuwutigongfangdejiekoubangding,jianhualeshiyongspring cloud ribbonshi,zidongfengzhuangfuwudiaoyongkehuduandekaifaliang。

  三、Feign集成了Ribbon

  liyongribbonweihulemicroservicecloud-deptdefuwuliebiaoxinxi,bingqietongguolunxunshixianlekehuduandefuzaijunheng。eryuribbonbutongdeshi,tongguofeignzhixuyaodingyifuwubangdingjiekouqieyishengmingshidefangfa,youyaerjiandandeshixianlefuwudiaoyong。

  四、Feign的使用

  zaijiekoushang:

  //shiyongfeign,bingzhidingfuwu

  @feignclient(value = "spider8001",fallbackfactory = spiderclientservicefallbackfactory.class)

607的彩的正确网址  public interface spiderclientservice {

  @requestmapping("/search")

  string search(@requestparam(value = "keyword")string keyword, @requestparam(value="currentpage",defaultvalue = "1") int currentpage, @requestparam(value="pagesize",defaultvalue = "10") int pagesize);

  }

  zaiqidonglei:

  @springbootapplication

  @enableeurekaclient

  @ribbonclient(name="spider8001")

607的彩的正确网址  @enablefeignclients(basepackageclasses = spiderclientservice.class)

607的彩的正确网址  @enablehystrixdashboard

  public class spiderconsumer9001app {

  public static void main(string[] args)

  {

607的彩的正确网址  springapplication.run(spiderconsumer9001app.class, args);

  }

  }

  五、Feign的使用小结

  zaispring cloudyingyongzhong,dangwomenyaoshiyongfeignkehuduanshi,yibanyaozuoyixiasanjianshiqing :

607的彩的正确网址  1)shiyongzhujie@enablefeignclientsqiyongfeignkehuduan;

  @springbootapplication

  @enableeurekaclient

607的彩的正确网址  @ribbonclient(name="spider8001")

  @enablefeignclients(basepackageclasses = spiderclientservice.class)

  @enablehystrixdashboard

  public class spiderconsumer9001app {

  public static void main(string[] args)

  {

  springapplication.run(spiderconsumer9001app.class, args);

  }

  }

607的彩的正确网址  2)shiyongzhujie@feignclient dingyifeignkehuduan ;

607的彩的正确网址  shili : gailizidingyileyigefeignkehuduan,jiangyuanchengfuwuyingsheweiyigebendijavafangfadiaoyong。

  //shiyongfeign,bingzhidingfuwu

  @feignclient(value = "spider8001",fallbackfactory = spiderclientservicefallbackfactory.class)

607的彩的正确网址  public interface spiderclientservice {

  @requestmapping("/search")

607的彩的正确网址  string search(@requestparam(value = "keyword")string keyword, @requestparam(value="currentpage",defaultvalue = "1") int currentpage, @requestparam(value="pagesize",defaultvalue = "10") int pagesize);

  }

607的彩的正确网址  3)shiyongzhujie@autowiredshiyongshangmiansuodingyifeigndekehuduan ;

607的彩的正确网址  @autowired

607的彩的正确网址  private spiderclientservice service;

  shangmiandesangebuzhou,qianlianggebuzhoukeyilijieweidingyifeignkehuduan,disanbushishiyongsuodingyidefeignkehuduan。tongguodiaoshifaxian,shangmiandisanbusuozhurudetestserviceshiyigedailiduixiang。gaiduixianghuidailikehuduanwanchengyuanchengfuwufangfadediaoyong

607的彩的正确网址  shiyongzhujie@enablefeignclients shi,xiangdangyuqiyonglefeignkehuduandingyidesaomiaohezhucejizhi,congerkeyifaxiankaifarenyuantongguozhujie@feignclientdingyidefeignkehuduan,bingzuizhongzuoweibeandingyizhucedaorongqizhong。ertongguo@autowiredzidongzhuangpeizhujie,zheixiefeignkehuduanhuiyireflectivefeign$feigninvocationhandlerdongtaidailidexingshibeizhurudaoshiyongfang。gaifeignkehuduanbaohanleduimeigejiekoufangfadechuliqimethodhandler,jiekouqueshengfangfaduiyingdefaultmethodhandler,fuwugongnengduandianfangfaduiyingsynchronousmethodhandler。

baoqian!pinglunyiguanbi.

2元中国福利彩票怎么看 2元买彩票选几个数字 2元中国福利彩票的买法 2元就可以打1毛的斗地主棋牌 2元彩是值得您信赖的 2元斗地主群 2元的彩的网 2元彩票双色球走势图双色球 2元彩票网全国走势图 2元就可以打1毛的炸金花棋牌