Spring Cloud Config-Client 无法获取 Config-Server 在 github 上的配置文件的属性值,竟然是因为!!!

2018年07月23日 16:33:25
一颗很菜的菜
阅读数 5907

版权声明:本文为博主原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接和本声明。

Spring Cloud Config-Server 配置中心 配置文件放在github,配置文件均为bootstrap.yml(bootstrap.yml的优先级级比application.yml高,所以会先去github配置中心获取信息)

运行 Spring Cloud Config-Client 应用程序时,报错信息如下:


  1. java.lang.IllegalArgumentException: Could not resolve placeholder 'from' in value "${from}"
  2. at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:172) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  3. at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:124) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  4. at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:237) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  5. at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:211) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  6. at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  7. at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:839) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  8. at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1086) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  9. at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  10. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  11. at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  12. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373) ~[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE]
  13. ... 17 common frames omitted

!!!原因!!!

github上的配置文件的名字构成必须是: {application}-{profile}.properties

仓库中的配置文件会被转换成web接口,访问可以参照以下的规则:

//[/]:

~: /-.yml
~: //-.yml
~: /-.properties
~: //-.properties

比如:config-client的配置文件信息如下:


  1. eureka:
  2. client:
  3. serviceUrl:
  4. defaultZone: http://peer1:1122/eureka/
  5. spring:
  6. application:
  7. name: config-client
  8. cloud:
  9. config:
  10. uri: http://localhost:9200/
  11. label: master
  12. profile: dev
  13. server:
  14. port: 9300
那么在github中的配置文件名必须是:config-client-dev.properties;否则程序启动不起来。

Spring Cloud Config-Client 无法获取 Config-Server 在 github 上的配置文件的属性值,竟然是因为的更多相关文章

  1. 【转载】一起来学Spring Cloud | Eureka Client注册到Eureka Server的秘密

    LZ看到这篇文章感觉写得比较详细,理解以后,便转载到自己博客中,留作以后回顾学习用,喝水不忘挖井人,内容来自于李刚的博客:http://www.spring4all.com/article/180 一 ...

  2. Lingo (Spring Remoting) : Passing client credentials to the server

    http://www.jroller.com/sjivan/entry/lingo_spring_remoting_passing_client Lingo (Spring Remoting) : P ...

  3. Spring Cloud Alibaba(二) 配置中心多项目、多配置文件、分目录实现

    介绍 之前Spring Cloud Config基础篇这篇文章介绍了Spring Cloud Config 配置中心基础的实现,今天继续聊下Spring Cloud Config 并结合nacos做服 ...

  4. 随手记一次用C#正则表达式获取下拉菜单html标签<select>以及相关属性值

    随手记一次用C#正则表达式获取下拉菜单html标签<select>以及相关属性值 1:有如下html: .................. <select id="aaa ...

  5. 玩转Spring Cloud之配置中心(config server &config client)

     本文内容导航: 一.搭建配置服务中心(config server) 1.1.git方式 1.2.svn方式 1.3.本地文件方式 1.4.解决配置中包含中文内容返回乱码问题 二.搭建配置消费客户端( ...

  6. spring cloud: 使用consul来替换config server

    上一篇提到了,eureka 2.x官方停止更新后,可以用consul来替代,如果采用consul的话,其实config server也没必要继续使用了,consul自带kv存储,完全可以取代confi ...

  7. Spring Cloud(十四)Config 配置中心与客户端的使用与详细

    前言 在上一篇 文章 中我们直接用了本应在本文中配置的Config Server,对Config也有了一个基本的认识,即 Spring Cloud Config 是一种用来动态获取Git.SVN.本地 ...

  8. spring cloud 系列第8篇 —— config+bus 分布式配置中心与配置热刷新 (F版本)

    源码Gitub地址:https://github.com/heibaiying/spring-samples-for-all 一.config 简介 spring cloud config 分为服务端 ...

  9. Spring Cloud(9):Config配置中心

    Config配置中心作用简单来讲:统一配置,方便管理 开源配置中心: 1.百度Disconf 2.阿里Diamand 3.Spring Cloud Config 搭建Config-Server 快速上 ...

随机推荐

  1. win10安装mysql__艰难的心路历程

    俺是新系统,嘿嘿嘿 首先,把下载好的压缩包解压到安装目录中,哪个盘可以. 第二,先创建my.ini文件,不然待会忘了.在文件中添加以下内容: [mysqld] port = basedir=C:\Wi ...

  2. delphi 用户可以点击格式修改进行模板修改

    过程 TlistRepAdd.Btn_GCListRepEditClick窗口 TlistRepAdd 补打流程单 1. 给用户权限 呈现出格式修改按钮 procedure TlistRepAdd.B ...

  3. Java怎样实现解析身份证号

    身份证号解析,demo /** * 身份证号解析demo * */ public class TestArea { public static void main(String[] args) { S ...

  4. Allegro文档错误之:Iangle 命令

    Allegro绘制弧线时,可以使用add rarc命令,或者菜单栏里 Add|Arc w/Radius. 使用该命令时,需要输入3个参数: 1,圆心坐标:如 x –0.3 –0.8 2,半径,以及起始 ...

  5. 表单 用jquery做输入脱离焦点 进行正则验证

    <!-- 账号登录块 -->       <form class="form1" action="" method="get&quo ...

  6. windows 嵌入控制台

    { 实际非常简单 需要控制台的hwnd 和 hdc 能获取控制台的hwnd 那hdc 就出来了 有了hdc 还有什么不能干的呢?? 如果会win32 窗口编程的就知道hdc,是一个让人流口水的类型 } ...

  7. 安装rancher以及使用rancher倒入kubernetes集群和添加及管理集群

    1.docker安装rancher [root@rancher ~]# docker run -d --name rancher --restart=unless-stopped -p : -p : ...

  8. hibernate_06_hibernate的延迟加载和抓取策略

    1.延迟加载 1>类级别的延迟加载 指的是通过oad方法查询某个对象的时候,是否采用延迟, session. load(Customer class1L) 类级别延迟加载通过<class& ...

  9. (转)第04节:Fabric.js用路径画不规则图形

    在Canvas上画方形.圆形.三角形都是很容易的,只要调用fabric对应的方法就可以了,但这些都是规则的图形,如果你想画一个不规则的图形,这时候你可以用fabric.js提供的路径绘图方法.所谓路径 ...

  10. Ubunto 无法连接ssh客服端

    解决办法: (1)查看ip地址是否冲突 我在单位的虚拟机ip地址是192.168.14.85,与其它机器冲突了.改成了192.168.14.83   (2)关闭Ubuntu14.04的防火墙 root ...