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

西安城市建设职业学院官方网站自己给公司做网站该怎么做

西安城市建设职业学院官方网站,自己给公司做网站该怎么做,合肥网站制作公司排名,广州市网站建设科技公司前些天发现了一个巨牛的人工智能学习网站#xff0c;通俗易懂#xff0c;风趣幽默#xff0c;忍不住分享一下给大家。点击跳转到教程。 一、新建 ribbon 工程#xff1a; 1. file - new - module 2. spring Initializr - module SDK 选择自己的 JDK #xff0c;其余的可…前些天发现了一个巨牛的人工智能学习网站通俗易懂风趣幽默忍不住分享一下给大家。点击跳转到教程。 一、新建 ribbon 工程 1. file - new - module  2. spring Initializr - module SDK 选择自己的 JDK 其余的可以不用填写next。 3. 填写工程相关信息包名、工程名等next。 4. spring cloud discovery - 勾选 eureka discover clientnext。 或  spring cloud routing - 勾选 ribbonnext。此步这 2 种都可 5. 工程名代码存放位置等finish 。 6. 工程结构如下 7. pom.xml ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdcom.ribbon/groupIdartifactIdservice-ribbon/artifactIdversion0.0.1-SNAPSHOT/versionpackagingjar/packagingnameservice-ribbon/namedescription服务消费 ribbon 方式/descriptionparentgroupIdcom.base/groupIdartifactIdbase-config/artifactIdversion0.0.1-SNAPSHOT/version/parentdependenciesdependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-eureka-client/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.cloud/groupIdartifactIdspring-cloud-starter-netflix-ribbon/artifactId/dependency/dependenciesrepositoriesrepositoryidspring-milestones/idnameSpring Milestones/nameurlhttps://repo.spring.io/milestone/urlsnapshotsenabledfalse/enabled/snapshots/repository/repositories/project 8. 在工程启动类上加注解EnableDiscoveryClient  。 关于 2 个注解的区别见文章springcloud 注解 EnableDiscoveryClient 与 EnableEurekaClient 的区别 package com.ribbon.serviceribbon;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.web.client.RestTemplate;// 标明自已为服务 EnableDiscoveryClientSpringBootApplication public class ServiceRibbonApplication {public static void main(String[] args) {SpringApplication.run(ServiceRibbonApplication.class, args);}/*** 向 ioc 注入 bean : restTemplate;* 注解 LoadBalanced 此 bean 开启负载均衡。* return*/BeanLoadBalancedRestTemplate restTemplate() {return new RestTemplate();} }实现对于生产者服务的调用 SeeParamService package com.ribbon.serviceribbon;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate;/*** author yujiang* description* date 2019/7/22 11:45*/ Service public class SeeParamService {AutowiredRestTemplate restTemplate;public String seeService(String param) {return restTemplate.getForObject(http://see-param/seeParam?param param, String.class);}}SeeParamController package com.ribbon.serviceribbon;import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController;/*** /**** author yujiang* description* date 2019/7/22 13:27*/ RestController public class SeeParamController {AutowiredSeeParamService seeParamService;RequestMapping(value /seeParam)public String see(RequestParam String param) {return seeParamService.seeService(param);} }9. 配置文件相关设置 # 注册中心 - 端口 1234、工程名 eureka 见 eureka 工程中配置。 eureka.client.serviceUrl.defaultZone http://localhost:1234/eureka/# 端口 server.port 8701# 工程名 spring.application.name ribbon10.启动工程 11. 浏览器访问  http://localhost:8701/seeParam?param参数啊 。刷新多次请求得到不同端口服返回的结果 。 12. 从注册中心可知当前注册了4 个服务访问注册中心http://localhost:1234/ 13. 不断刷新 ribbon 工程访问地址可见 8801、8802、8803 都有请求到。图见第 11 点。 说明 负载均衡 已实现消费者服务请求方应用请求到了不同的生产者服务提供方应用。 14.总结 此时 整个工程体系为 1个注册中心eureka 工程端口1234 。 3个生产者 see-param 分别占用端口8801、8802、8803 三者都向 eureka  注册暴露自已提供的服务。 1个消费者 ribbon 工程端口8701 。向 eureka 注册 订阅自已所需要的服务。 ribbon 有作负载均衡故 在调用生产者服务时可轮流请求到不同的生产者服务。 ------------------------------------------------------------------------------ 遇到 问题1 解决方法见文章解决There was an unexpected error (typeInternal Server Error,..). No instances available for XXX 遇到 问题2 解决方法见文章解决Whitelabel Error Page This application has no explicit mapping for /error...UnknownHostException ------------------------------------------------------------------------ 下一篇springCloud - 第4篇 - 消费者调用服务 ( Feign ) 源码见https://gitee.com/FJ_WoMenDeShiJie/springcloud-ribbon -------------------------------------------------------------- PS这个系列不定时更新只是个人的学习分享 内容全程参考书目 《Spring Cloud 与 Docker 微服务架构空实战 》、 《Spring Cloud 微服务实战》及此书作者博客http://blog.didispace.com/spring-cloud-learning/ 《深入理解 Spring Cloud 与微服务构建》及此书作者博客https://blog.csdn.net/forezp/article/details/70148833 --------------------------------------------------------------
http://www.pierceye.com/news/828246/

相关文章:

  • 网站的管理上海创新网站建设
  • 企业对比网站西安做网站公司怎么样
  • 网站开发好做还是平面好做商务网页设计与制作是什么
  • 个人业务网站带后台凡科网站建设分类模块怎么弄
  • 在百度做网站需要什么资料appstore正版下载
  • wordpress怎么做404页面合肥seo软件
  • 建设网站挂广告赚钱免费个人网站源码
  • 网站ico图标动漫设计学什么内容
  • fireworks做网站定制做网站费用
  • 建设门户网站所需优秀营销网站设计
  • 行业网站建设教程办一家建筑公司流程
  • 网站空间文件夹中企动力主要是做什么的
  • 亚马逊做qa的网站wordpress theme是什么
  • 网站开发的经费预算php网站超市源码下载
  • 深圳建设高端网站asp.net 获取网站的绝对路径
  • 做的网站没流量吗前端页面设计
  • 门户网站的优点在环评备案网站上做登记后会怎么样
  • 网站的内容规划怎么写网站做外链的具体步骤
  • 百度网站排名规则小程序网站建设y021
  • 中国建设银行国际互联网站国内排名前五的电商
  • 怎么查网站的空间商四川建设工程招标网
  • 网站建设比较好公司朝阳区互联网公司排名
  • 百度不收录网站吗网站开发php
  • 房产网站建设的功能wordpress php7拓展
  • 做网站代码用什么软件天津建设工程信息网天津
  • 网站开发工程师前景怎么样怎么做自己的网站?
  • 井陉矿区网站建设做微商的网站
  • 办公室装修专业网站小程序免费制作平台有吗
  • 学生做兼职去哪个网站线上推广的渠道有哪些
  • 徐州网站的优化苏州百度推广开户