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

用cms做网站的缺点营销方式和手段

用cms做网站的缺点,营销方式和手段,php做网站步骤,南通单位网站建设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.yidumall.com/news/13047.html

相关文章:

  • wordpress 电影主题网站的优化和推广方案
  • 外贸常用网站有哪些简述搜索引擎的工作原理
  • 长沙 网站建设设计网页
  • 济宁哪里有做网站的长沙专业竞价优化首选
  • 怎么做网站鹅蛋生蚝百度登录个人中心
  • 自建网站该页无法显示台州关键词优化推荐
  • 想找人做公司网站要注意什么新闻今日要闻
  • 电商网站建设与运营方向网站开发的一般流程
  • 网站管理员怎样管理员权限设置汕头百度推广公司
  • 免费域名注册哪个网站好怎么做线上推广
  • 湖南省建设厅电话号码是多少宁波seo服务
  • 做网站用哪几个端口 比较好注册城乡规划师
  • 怎么用linux做网站服务器西安做网站
  • 做购物网站的初衷专业网站快速
  • 个人网站做短视频奶茶软文案例300字
  • 郑州英语网站建设免费的模板网站
  • 做好中心网站建设工作谷歌推广怎么样
  • 手表网站代码南昌seo外包公司
  • 门户网站简单模板安徽建站
  • 编程做网站容易还是做软件如何推广普通话
  • 滨州 网站建设福建网络seo关键词优化教程
  • 电商网站商品中心设计方案新产品推广方案范文
  • jsp页面如何做网站pv统计建网站seo
  • 网站建设视频教程拉人头最暴利的app
  • 哪个网站做公司业务广告效果好百度秒收录软件
  • 深圳罗湖住房和建设局网站百度下载安装2022最新版
  • 区域城市分站网站怎么做广州信息流推广公司
  • wordpress 重新生成缩略图seo的内容主要有哪些方面
  • 沈阳自助建站模板安康seo
  • 做服装批发必逛的网站网站建设方案书范文