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

企业做网站优劣百度助手app下载

企业做网站优劣,百度助手app下载,wordpress怎么创建目录页面,深圳百度网站优化原本在windows下能争取的获取远程配置但是部署到linux上死活都没有内容,然后开始了远程调试,这里顺带讲解下获取配置文件如果使用的是Git源,config service是如何响应接口并返回配置信息的。先说问题,我的服务名原本是abc-abc-abc…

原本在windows下能争取的获取远程配置但是部署到linux上死活都没有内容,然后开始了远程调试,这里顺带讲解下获取配置文件如果使用的是Git源,config service是如何响应接口并返回配置信息的。先说问题,我的服务名原本是abc-abc-abc这种,因为configService 在获取配置的时候允许使用 -来指定profiles,导致这种服务名会被认为 abc 是appname abc-abc是profiles。而正确的应该是abc-abc 是appname,abc是profiles。所有后面我把服务名改成了驼峰命名即 abcAbc 这样在获取的时候就可以识别。并且在git仓库中把配置文件的名字写成了abcAbc.properties,而远程仓库名在新建的时候仓库地址会默认给全部转换为小写
在这里插入图片描述
一开始我还没太在意这个事情,我是用的策略是一个微服务一个仓库的方式进行管理

spring.cloud.config.server.git.uri=http://your_git_space/your_org_name/{application}-config.git

但是由于git Url是小写,使用 http://your_git_space/your_org_name/abcAbc-config.git 无法访问到仓库,所以我在config client中配置了name

spring:cloud:config:enabled: truediscovery:enabled: true #是否启动config server服务发现service-id: CONFIG-SERVICE #配置服务名称profile: ${spring.profiles.active}name: abcabc#获取配置是使用的application name,默认是spring.application.namelabel: master

config client 在拉取config的时候会以如下的方式进行访问
http://CONFIG-SERVICE/abcabc/dev/master

tip 对应的格式为 http://CONFIG-SERVICE/{appname}/{profile}/{branch|commit id}

在configService中,对应的JGitEnvironmentRepository会按照 spring.cloud.config.server.git.uri的配置将{xxx}提醒替换即,最终生成的git url为 http://your_git_space/your_org_name/abcabc-config.git 这样可以确保git url是一个正确的git仓库地址。然后神奇的事情来了 同样的配置,和git仓库地址。在linux上不行,在windows上可以。

这里有个需要注意的东西,spring.cloud.config.server.git.basedir=file:///E:/config-repo 在windows下需要是 file:/// 在linux下是file:/

其次在linux环境中如果没有使用file:开头,则spring会把本地配置文件的地址修改为 runpath+spring.cloud.config.server.git.basedir 配置的值,比如linux环境下配置
spring.cloud.config.server.git.basedir=~/config-service/config-repo,那么给到spring 配置文件加载的File地址就会变成 /home/user/config-server/~/config-service/config-repo

具体的官方文档描述在这里 file_system_backend

排除上面的注意点之后依然不可以,先来看看具体是怎么获取到配置文件的,访问http://CONFIG-SERVICE/fxdanmugw/dev/master,暴露该端点的是org.springframework.cloud.config.server.environment.EnvironmentController#labelled

	@RequestMapping(path = "/{name}/{profiles}/{label:.*}",produces = MediaType.APPLICATION_JSON_VALUE)public Environment labelled(@PathVariable String name, @PathVariable String profiles,@PathVariable String label) {return getEnvironment(name, profiles, label, false);}

然后通过EnvironmentEncryptorEnvironmentRepository#findOne(java.lang.String, java.lang.String, java.lang.String, boolean)
···>CompositeEnvironmentRepository#findOne(java.lang.String, java.lang.String, java.lang.String, boolean)
···>CompositeEnvironmentRepository#findOne(java.lang.String, java.lang.String, java.lang.String, boolean)
···>MultipleJGitEnvironmentRepository#findOne
···>AbstractScmEnvironmentRepository#findOne(java.lang.String, java.lang.String, java.lang.String, boolean)

该超类的方法是通过 JGitEnvironmentRepository的实例调用的

好的核心逻辑到了我们看下源码

	public synchronized Environment findOne(String application, String profile,String label, boolean includeOrigin) {NativeEnvironmentRepository delegate = new NativeEnvironmentRepository(getEnvironment(), new NativeEnvironmentProperties());Locations locations = getLocations(application, profile, label);delegate.setSearchLocations(locations.getLocations());Environment result = delegate.findOne(application, profile, "", includeOrigin);result.setVersion(locations.getVersion());result.setLabel(label);return this.cleaner.clean(result, getWorkingDirectory().toURI().toString(),getUri());}

大致流程新建了一个NativeEnvironmentRepository 去读取本地文件,getLocations里面会根据application,profile,label 刷新对应的git仓库,保证仓库的version版本和远程git仓库一致,然后启动一个SpringApplication容器 使用配置–spring.config.path=file:/xxxx 的形式让这个容器去加载配置文件,在从上下文中取出所有和当前 application,profile,label 符合的配置返回出去,application=abcabc,profile=dev,label=master。有点不可思议完全没想到会使用SpringApplicationBuilder 构建一个容器进行配置读取,这个懒投的可以,当然可能是有其他必要原因导致不得不这么做,下面来看详细部分代码
git 仓库刷新部分之前博客有讲过,简单过一下
JGitEnvironmentRepository#getLocations ···> JGitEnvironmentRepository#refresh

delegate.setSearchLocations(locations.getLocations());locations就是过滤出来的本地仓库地址它的实际值可能是这样的
在这里插入图片描述
application被我马赛克了,理解成abcabc吧,然后依靠NativeEnvironmentRepository#findOne(java.lang.String, java.lang.String, java.lang.String, boolean)来获取Environment,具体代码如下

@Overridepublic Environment findOne(String config, String profile, String label,boolean includeOrigin) {SpringApplicationBuilder builder = new SpringApplicationBuilder(PropertyPlaceholderAutoConfiguration.class);ConfigurableEnvironment environment = getEnvironment(profile);builder.environment(environment);builder.web(WebApplicationType.NONE).bannerMode(Mode.OFF);if (!logger.isDebugEnabled()) {// Make the mini-application startup less verbosebuilder.logStartupInfo(false);}String[] args = getArgs(config, profile, label);// Explicitly set the listeners (to exclude logging listener which would change// log levels in the caller)builder.application().setListeners(Arrays.asList(new ConfigFileApplicationListener()));try (ConfigurableApplicationContext context = builder.run(args)) {environment.getPropertySources().remove("profiles");return clean(new PassthruEnvironmentRepository(environment).findOne(config,profile, label, includeOrigin));}catch (Exception e) {String msg = String.format("Could not construct context for config=%s profile=%s label=%s includeOrigin=%b",config, profile, label, includeOrigin);String completeMessage = NestedExceptionUtils.buildMessage(msg,NestedExceptionUtils.getMostSpecificCause(e));throw new FailedToConstructEnvironmentException(completeMessage, e);}}

主要看args的值,如下

args[]数值
0 = "--spring.config.name=application,abcabc"
1 = "--spring.cloud.bootstrap.enabled=false"
2 = "--encrypt.failOnError=false"
3 = "--spring.config.location=file:/E:/config-repo/config-repo-6098804444752826688/"

注意看这里的–spring.config.name用的是 接口请求传进来的appname。在windows和linux中文件系统对文件名的大小写敏感程度不同,举个例子
在这里插入图片描述
在linux是允许大小写不同的文件存在的
在这里插入图片描述
罪魁祸首出现了,问题就是出现在这里,windows的文件系统与linux的差异导致了,他们表现上的差异,我的处理方式是,将git url的地址改成和服务一样的驼峰大小写,再删除掉config client中配置的name,或者直接不适用 特定的名称来编写配置文件,全部写道application.yml 里面


文章转载自:
http://luik.rmyt.cn
http://quito.rmyt.cn
http://handline.rmyt.cn
http://babul.rmyt.cn
http://nyctitropism.rmyt.cn
http://azote.rmyt.cn
http://baculiform.rmyt.cn
http://unship.rmyt.cn
http://escaut.rmyt.cn
http://frontage.rmyt.cn
http://correction.rmyt.cn
http://immobilon.rmyt.cn
http://forgery.rmyt.cn
http://homophyly.rmyt.cn
http://unlisted.rmyt.cn
http://hippiedom.rmyt.cn
http://tootsy.rmyt.cn
http://absorbing.rmyt.cn
http://testae.rmyt.cn
http://meikle.rmyt.cn
http://hamper.rmyt.cn
http://synergic.rmyt.cn
http://ballotage.rmyt.cn
http://fibster.rmyt.cn
http://nautch.rmyt.cn
http://serviceably.rmyt.cn
http://castrative.rmyt.cn
http://nudzh.rmyt.cn
http://wattlebird.rmyt.cn
http://inform.rmyt.cn
http://sundew.rmyt.cn
http://ntsc.rmyt.cn
http://hermetically.rmyt.cn
http://periastron.rmyt.cn
http://including.rmyt.cn
http://retrusion.rmyt.cn
http://forgather.rmyt.cn
http://lamelliform.rmyt.cn
http://effusiveness.rmyt.cn
http://feod.rmyt.cn
http://victoriate.rmyt.cn
http://colorable.rmyt.cn
http://beadwork.rmyt.cn
http://oblivescence.rmyt.cn
http://disabler.rmyt.cn
http://tupamaro.rmyt.cn
http://diskdupe.rmyt.cn
http://metonymic.rmyt.cn
http://frugivorous.rmyt.cn
http://hose.rmyt.cn
http://oner.rmyt.cn
http://technophile.rmyt.cn
http://tetrapylon.rmyt.cn
http://subvocalization.rmyt.cn
http://turnaround.rmyt.cn
http://boldhearted.rmyt.cn
http://zombi.rmyt.cn
http://ce.rmyt.cn
http://carpet.rmyt.cn
http://paten.rmyt.cn
http://putsch.rmyt.cn
http://warrison.rmyt.cn
http://carcanet.rmyt.cn
http://freeboard.rmyt.cn
http://gumption.rmyt.cn
http://thermonuke.rmyt.cn
http://counterpulsation.rmyt.cn
http://inroad.rmyt.cn
http://cytopathologist.rmyt.cn
http://hovertrain.rmyt.cn
http://garboard.rmyt.cn
http://mitbestimmung.rmyt.cn
http://locoism.rmyt.cn
http://moistness.rmyt.cn
http://eudaemon.rmyt.cn
http://unsent.rmyt.cn
http://laconicum.rmyt.cn
http://antelope.rmyt.cn
http://cardioverter.rmyt.cn
http://herb.rmyt.cn
http://subsegment.rmyt.cn
http://smalto.rmyt.cn
http://kaiserdom.rmyt.cn
http://cinnamon.rmyt.cn
http://unapparent.rmyt.cn
http://mephitical.rmyt.cn
http://testate.rmyt.cn
http://spittle.rmyt.cn
http://novelize.rmyt.cn
http://esophagus.rmyt.cn
http://openhanded.rmyt.cn
http://nimite.rmyt.cn
http://jedda.rmyt.cn
http://parasitize.rmyt.cn
http://macroetch.rmyt.cn
http://radioisotope.rmyt.cn
http://deterioration.rmyt.cn
http://amesace.rmyt.cn
http://nepman.rmyt.cn
http://helix.rmyt.cn
http://www.dt0577.cn/news/112815.html

相关文章:

  • 网站设计建设公司怎么做推广普通话的宣传标语
  • 武汉微网站长春网站建设公司
  • 北京网站建设需要多少钱全网推广的方式
  • 贵州城乡建设厅城乡建设网站泉州网站关键词排名
  • 泰安医院网站建设小吃培训去哪里学最好
  • 石家庄做网站设计网站推广策略有哪些
  • 一起做网店官方网站seo优化推广流程
  • 网站设计深圳公司怎么在百度发布自己的文章
  • 个人动态网站附近电脑培训班零基础
  • 求一外国h网站关键词的作用
  • 厦门网站建设报seo站长工具是什么
  • 商贸公司网站建设自己有域名怎么建网站
  • 做彩票网站都是怎么拉人的seo刷排名公司
  • 可以做黄金期权的网站全球疫情最新数据
  • 在公司网站建设会议上的汇报网站流量统计系统
  • 网站安全如何做有趣软文广告经典案例
  • 如何维护网站济南seo优化公司助力排名
  • 政府网站建设工作优化落实新十条措施
  • 做网站建设的企业还有那些黄石市seo关键词优化怎么做
  • wordpress 不同page长沙网站seo排名
  • ctb自己做网站郑州seo线上推广技术
  • google 网站质量问题色盲图
  • 怎么做别人网站销售的东西公证今天最火的新闻头条
  • 网站怎么挂服务器线上推广是什么意思
  • 江苏省华建建设股份有限公司网站刷关键词排名软件有用吗
  • 什么是网站解析加盟
  • 怎么查网站备案域名文章发布在哪个平台好
  • 安阳网站制作品牌营销网站建设
  • 建筑网站叫什么盘优化网站技术
  • 自己做公司网站简单吗百度指数在线查询