当前位置: 首页 > news >正文

用cms做网站的缺点百度惠生活商家入驻

用cms做网站的缺点,百度惠生活商家入驻,域名停靠万网域,网站建设公司武汉1.概要 1.1 说明 这个是在前一个测试上的修改,所以这里只体现修改的内容。前一个测试的地址:检查实验 spring cloud nacos nacos-server-2.3.0-CSDN博客 1.2 记忆要点 1.2.1 引入对象 Autowired DiscoveryClient discoveryClient; 1.2.2 获取服务实…

1.概要

1.1 说明

这个是在前一个测试上的修改,所以这里只体现修改的内容。前一个测试的地址:检查实验 spring cloud nacos nacos-server-2.3.0-CSDN博客

1.2 记忆要点

1.2.1 引入对象

@Autowired
DiscoveryClient discoveryClient;

1.2.2 获取服务实例 

List<ServiceInstance> serviceInstances = discoveryClient.getInstances("server3");
int index = new Random().nextInt(serviceInstances.size());
ServiceInstance serviceInstance = serviceInstances.get(index);

1.2.3 利用服务实例调用函数 

String url = "http://"+serviceInstance.getHost()+":"+serviceInstance.getPort()+"/fun";

2.代码变更

package com.xjc.springcloundtest;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;import java.util.List;
import java.util.Random;@RestController
public class TestController2 {@AutowiredDiscoveryClient discoveryClient;//@Autowired//FenTest fenTest;@AutowiredRestTemplate restTemplate;@RequestMapping("/fun2")public String fun2(){List<ServiceInstance> serviceInstances = discoveryClient.getInstances("server3");int index = new Random().nextInt(serviceInstances.size());ServiceInstance serviceInstance = serviceInstances.get(index);//String url = "http://localhost:8080/fun";//String url = "http://server3/fun";String url = "http://"+serviceInstance.getHost()+":"+serviceInstance.getPort()+"/fun";//String ret = fenTest.fun();String ret = restTemplate.getForObject(url,String.class);return "函数2"+ret;}
}

3 运行结果

http://www.qdjiajiao.com/news/2772.html

相关文章:

  • 合肥网站开发网络营销优化
  • 花生壳 建设网站南昌seo招聘信息
  • 北京网站手机站建设公司吗google play商店
  • 做公司宣传册的网站旺道智能seo系统
  • 企业建设网站的预期收益百度推广代理商利润
  • 2017电商网站建设背景网站设计专业的公司
  • 怎么用html做百度首页网站做seo必须有网站吗
  • 站群建站济南网络优化网站
  • 网站的交互体验今日nba数据帝
  • 黑苹果做网站开发吗梁水才seo优化专家
  • 莱芜网站制作seo优化网络推广
  • 怎么自己搭建网站竞价代运营公司哪家好
  • 沈阳模板建站方案搜狗搜索推广
  • 网站建设报告论文类似凡科建站的平台
  • 创意设计广告关于seo如何优化
  • 专业外贸网站制作搜索引擎seo优化平台
  • 网站建设找天宇智能千锋教育可靠吗
  • 建站知识百度指数入口
  • 网站建设维护保密协议书可以发外链的论坛有哪些
  • 上海建设人才网站国外引流推广平台
  • 苏州手机网站制作网络营销与电子商务的区别
  • 郑州网站建设公司哪家专业好营销型企业网站推广的方法有哪些
  • 独立外贸网站网站seo是什么意思
  • 申请网站平台怎么做网站的网络推广
  • wordpress 中英主题什么软件可以优化关键词
  • 如何做网站备案郑州客串seo
  • 海南网站优化seo是什么牌子
  • 天河建设网站哪个好电脑系统优化软件十大排名
  • 企业所得税2022年税率seo免费诊断电话
  • 淮安哪里有做网站的人百度客服电话4001056