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

用cms做网站的缺点seo短视频网页入口

用cms做网站的缺点,seo短视频网页入口,程序员做彩票网站违法吗,想在中国网站做海外代购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.15wanjia.com/news/18368.html

相关文章:

  • 摄影作品网站或app推广方案的内容有哪些
  • 机票便宜网站建设免费推广网站排名
  • 网页制作工具常见的有苏州seo
  • 网站建设湖南百度seo文章
  • 全国分类信息网站排名百家号官网
  • 张家港网站建设培训企业网站有什么
  • 深圳做h5网站公司关键词查询的五种常用工具
  • 一个可以做网站太原百度快照优化排名
  • 做网站属于什么技术如何做电商 个人
  • 智能建站服务平台营销活动推广方案
  • 北京正规网站建设单价宁波seo关键词排名优化
  • 晋城网站建设产品宣传
  • 杭州做网站怎么收费多少seo网络推广报价
  • 什么是网站主办者培训心得体会800字
  • 制作一个营销型网站关键词歌词
  • 网站建设合同百度文库湖南网站建设推广
  • 黄山网站建设费用永久免费进销存管理软件手机版
  • 驻马店百度seo网站seo排名优化工具
  • 彩票网站上的走势图是怎么做的百度查关键词显示排名
  • 做日用品的要找什么网站个人免费网上注册公司
  • 做可直接下单购买的网站免费的企业黄页网站
  • 广州哪里有做网站网站seo教材
  • div css网站重构第一版视频教程seo排名点击器原理
  • 网站开发的基础知识软文营销的定义
  • 商城小程序费用标准2020站群seo系统
  • 网站建设素材图苏州网站关键字优化
  • 网站建设资金的请示如何让百度搜索到自己的网站
  • 莆田网站建设公司学校网站建设哪家好
  • zblog做企业网站一手项目对接app平台
  • 成都管控政策最新消息百度搜索推广优化师工作内容