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

怎么做自己公司的网站宁波网站的优化

怎么做自己公司的网站,宁波网站的优化,网站开发总跳转至404页面,镇江润州区建设局网站config是一个微服务配置组件#xff0c;为微服务提供集中化的配置管理服务。config包含服务端和客户端#xff0c;客户端在启动服务时从服务端拉取配置信息#xff0c;服务端响应客户端的请求提供具体的配置。本章分析config组件配置信息的拉取过程 1、config服务端 服务端… config是一个微服务配置组件为微服务提供集中化的配置管理服务。config包含服务端和客户端客户端在启动服务时从服务端拉取配置信息服务端响应客户端的请求提供具体的配置。本章分析config组件配置信息的拉取过程 1、config服务端 服务端响应请求的过程比较简单主要由spring-cloud-config-server包下EnvironmentController负责 RestController RequestMapping(method {RequestMethod.GET},path {${spring.cloud.config.server.prefix:}} ) public class EnvironmentController {/*** 根据环境类型和文件名拉取信息**/ RequestMapping(path {/{name}/{profiles:.*[^-].*}},produces {application/json})public Environment defaultLabel(PathVariable String name, PathVariable String profiles) {return this.getEnvironment(name, profiles, (String)null, false);}public Environment getEnvironment(String name, String profiles, String label, boolean includeOrigin) {name this.normalize(name);label this.normalize(label);Environment environment this.repository.findOne(name, profiles, label, includeOrigin);if (this.acceptEmpty || environment ! null !environment.getPropertySources().isEmpty()) {return environment;} else {throw new EnvironmentNotFoundException(Profile Not found);}}} getEnvironment方法会调用EnvironmentRepository接口的实现类来查找环境信息类似dao层 public interface EnvironmentRepository {Environment findOne(String application, String profile, String label);default Environment findOne(String application, String profile, String label, boolean includeOrigin) {return this.findOne(application, profile, label);} }2、config客户端 springboot在启动时会调用applyInitializers方法这个方法会遍历ApplicationContextInitializer接口的实现类并调用它们的initialize方法 【SpringBoot】SpringBoot源码解析第二章 SpringBoot的run方法-CSDN博客 protected void applyInitializers(ConfigurableApplicationContext context) {for (ApplicationContextInitializer initializer : getInitializers()) {Class? requiredType GenericTypeResolver.resolveTypeArgument(initializer.getClass(),ApplicationContextInitializer.class);Assert.isInstanceOf(requiredType, context, Unable to call initializer.);initializer.initialize(context);} } config客户端中的PropertySourceBootstrapConfiguration类实现了ApplicationContextInitializer接口它的工作就是拉取远程的配置信息并与本地信息整合 public void initialize(ConfigurableApplicationContext applicationContext) {...while(true) {Collection source;do {do {...PropertySourceLocator locator (PropertySourceLocator)var5.next();// 拉取远程配置信息source locator.locateCollection(environment);} while(source null);} while(source.size() 0);...}} ConfigServicePropertySourceLocator是PropertySourceLocator接口的实现类查看它的locate方法 Retryable(interceptor configServerRetryInterceptor ) public PropertySource? locate(Environment environment) {...for(int var11 0; var11 var10; var11) {String label var9[var11];...// 发送请求org.springframework.cloud.config.environment.Environment result this.getRemoteEnvironment(restTemplate, properties, label.trim(), state);...} }private Environment getRemoteEnvironment(RestTemplate restTemplate, ConfigClientProperties properties, String label, String state) {String path /{name}/{profile};String name properties.getName();String profile properties.getProfile();String token properties.getToken();...response restTemplate.exchange(uri path, HttpMethod.GET, entity, org.springframework.cloud.config.environment.Environment.class, args);...} } locate方法发送具体的请求拉取过来的远程信息会被整合入本地 3、总结 config服务端负责响应请求config客户端在服务启动时会从服务端拉取配置信息
http://www.zqtcl.cn/news/770125/

相关文章:

  • 有哪些可以做策划方案的网站国家域名
  • vk网站做婚介做seo排名好的网站
  • 广州企业网站建设公司苏州建网站提
  • html如何做购物网站天元建设集团有限公司法人代表
  • 教育培训机构排名seo是搜索引擎营销
  • 做奢侈品网站有哪些沧州手机建站哪家好
  • 德州网站网站建设广西房管局官网
  • 白石桥做网站公司seo顾问服务四川
  • 网站建设注册哪类商标十大网页设计公司
  • 网站建设的源代码有什么作用金华网站建设优化技术
  • 个人网站申请做瞹瞹嗳视频网站在线观看
  • 做网站 融资玉石网站建设的定位
  • 自己做的网站字体变成方框seo同行网站
  • 宁波网站建设培训微信小程序开发平台官网
  • 西部数码做的网站打不开哈尔滨模板建站推荐
  • 外贸网站建设流程杭州软件定制开发
  • 网站的首页面设计软文推广特点
  • 网站描述在哪里写网页设计图片怎么换
  • 深圳网站关键词优化推广做mod游戏下载网站
  • 通达oa 做网站wordpress动转换标签别名
  • 三亚学做网站培训招聘网站排名
  • 企业网站建设费用需要多少钱怎样下载建设银行信用卡网站
  • 厦门建网站公司怎么做服装外贸网站
  • 做淘宝客网站用什么程序好仿站下载工具
  • 网站地图开发国家住房和城乡建设部中国建造师网站
  • 巫山网站建设泉州市培训建设系统中心网站
  • 网站开发国内外研究背景室内设计师收入高吗
  • 深圳网站维护一般多少钱沈阳做网站黑酷科技
  • 汽车营销服务网站建设怎样申请微信公众号个人
  • 阿里云 做网站北京工程建设交易中心网站