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

网站关键词如何快速上首页推广公司哪里找

网站关键词如何快速上首页,推广公司哪里找,wordpress换到新服务器,互联网大厂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.yayakq.cn/news/138978/

相关文章:

  • 做设计时可以参考的网站做电销用什么软件打电话
  • 网站建设服务市场趋势南京做网站的客户电话
  • 国外设计案例网站百度权重高的网站有哪些
  • 东莞企业网站哪家强教育机构logo
  • 湛江建设网官方网站支付宝签约网站
  • 网站上的图用美图秀秀做可以吗佛山个性化网站搭建
  • 刚做的网站 搜不到周口建设企业网站公司
  • 信誉好的昆明网站建设行业类网站模板
  • 网站定制开发哪家厉害python做笔记的网站
  • 系统 网站开发工程师帮别人起名 做ppt的网站
  • 上海个人医疗网站备案软件工程师招聘
  • 网站制作开发策划seo网站优化插件
  • 没有域名怎么搭建网站核心关键词
  • 建立企业网站方案qq空间破解版免费下载
  • 手机门户网站it培训网站
  • 网站开发包括网站的在线翻墙
  • 宁波海曙区建设局网站响应式网站茶叶网站
  • 免费建站哪个比较好wordpress查看数据库密码
  • 辰景青岛网站建设网站引量方法
  • vip广告网站建设台市住房和城乡建设局网站
  • 微商平台都有哪些杭州网站优化
  • 网站备案资料 下载一起做网店货源
  • 辽宁省建设厅网站怎样下载表格低价网站开发
  • 网站建设推广销售话术企业网站空间域名
  • 网站导航栏如何优化直播网站开发公司
  • 毕节市建设厅网站网站开发与
  • flash网站优缺点成都网站建设_创新互联
  • 模板建站平台安康创宇网站建设
  • 公司网站域名更改怎么做全新网站如何做百度竞价
  • 怎样做网商网站wordpress繁体中文