loading multiple properties with config-server

浪子不回头ぞ 提交于 2019-12-06 00:02:30

You can create a general application.yml in the root folder of SVN.

See the example config repo here: https://github.com/spring-cloud-samples/config-repo

And here is an example consumer https://github.com/spring-cloud-samples/customers-stores/blob/master/rest-microservices-store/src/main/resources/bootstrap.yml

The customer-stores project will read from application.yml and also from stores.yml in the repo.

To confirm, check the /env URL if you have actuator added and you should see two configService entries

The spring.cloud.config.name property allows you to specify multiple application names separated by a comma, so all you have to do is change your application.yml to

spring:
  application:
    name: foo-development
  cloud:
    config:
      uri: http://localhost:${config.port:8888}
      name: foo-development,myshared

This will load both foo-development properties as well as myshared properties.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!