springcloud 笔记

config

启用配置中心:

命令行参数不能覆盖 远程配置中心配置 的问题排查

spring-cloud-context-2.0.0.RC2-sources.jar!/org/springframework/cloud/bootstrap/config/PropertySourceBootstrapProperties.java
这个文件 三个属性:

  • allowOverride = true
  • overrideNone = false
  • overrideSystemProperties = true

看注释根本理解不了。 在get 方法上打断点开调试。

实验结果:

  1. config 使用文件系统, 不使用git (使用git ,修改配置需要提交 )

    spring.profiles.active: native
    spring.cloud.config.profile: native
    spring.cloud.config.server.native.search-locations: file:/home/udi/IdeaProjects/app.shop.java/config/git/{application}

  2. 在 配置中心相应的 application应用配置文件中 添加 spring.cloud.config.overrideNone: true
    文件位置: /home/udi/IdeaProjects/app.shop.java/config/git/shop-api/application.yml

猜你喜欢

转载自www.cnblogs.com/newsea/p/9162655.html