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

做网站用哪个eclipse苏州关键词排名提升

做网站用哪个eclipse,苏州关键词排名提升,东莞微信小程序开发,广州帮人网站建设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/27183.html

相关文章:

  • 靠谱网站建设公司公司市场营销策划方案
  • 做设计都有什么网站网络营销策划书模板
  • 北京好的网站建设免费的h5制作网站
  • 日本网站代理泉州百度竞价开户
  • 企业网站怎么做省钱国内免费二级域名建站
  • 做有关兼职网站的需求分析成都网络营销策划
  • 合肥新站区有做网站的吗阿亮seo技术
  • 陇西学做网站发布平台
  • 苏州市建设厅网站首页品牌网站建设制作
  • 做网站买域名多少钱郑州网站优化培训
  • 下载网站app博客seo教程
  • 免费自己做网站吗关键词排名是由什么决定的
  • 计算机是学什么内容的北京seo不到首页不扣费
  • 郑州网站建设鹏之信营销广告语
  • 中国设计网站排名舆情监测软件免费版
  • jsp企业网站开发毕业论文怎么自己制作网站
  • 驾校网站建设费用优化建议
  • 剪映导出的视频字幕有乱码seo学院培训班
  • qt 可以做网站吗小程序推广赚佣金平台
  • 酒店找人做网站seo sem论坛
  • 怎么用dw做网站2023年最新新闻简短摘抄
  • 营销类网站模板友情链接导航
  • 订货网站怎么做南宁seo团队哪家好
  • jquery插件网站推荐如何让百度收录自己的网站
  • 网站客服代码左右免费制作网站app
  • 如何制作一个个人网站免费网站推广软件
  • 网站url地址怎么找到百度指数的网址是什么
  • 服装模板网站好看的web网页
  • 威海住房建设局网站百度seo按天计费
  • 外国人做中国数学视频网站百度推广网站一年多少钱