【问题标题】:Common properties for all profile of one service: spring cloud config一项服务的所有配置文件的通用属性:spring cloud config
【发布时间】:2019-05-11 05:44:16
【问题描述】:

我想为一项服务在所有配置文件中设置通用属性。怎么做?现在我有以下结构

application.properies
service1
   profile1
       service1.properties
   profile2
       service1.properties
service2
   profile1
       service2.properties
   profile2
       service2.properties

如何共享service1 的所有个人资料的公共属性?

【问题讨论】:

  • 添加名称为 profile 的文件,例如 service1-profile1.properties

标签: java spring-boot spring-cloud properties-file spring-cloud-config


【解决方案1】:

您可以在bootstrap.ymlbootstrap.properties 文件中定义这些属性:

application:
    name: "service1"

cloud:
    config:
      uri: "http://<hostname>:<port>"

# ... more common properties

【讨论】:

    猜你喜欢
    • 2015-01-03
    • 1970-01-01
    • 1970-01-01
    • 2015-06-18
    • 2022-12-04
    • 1970-01-01
    • 2020-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多