用配置服务器加载多个属性 [英] loading multiple properties with config-server

查看:92
本文介绍了用配置服务器加载多个属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功测试了从SVN信息库加载属性,目前在我的配置服务器中,我提供了URI和默认标签:trunk,并且我在 trunk 下具有应用程序特定的属性。以下是我使用的应用程序 application.yml 的内容,它能够成功提取属性

I have successfully tested loading properties from SVN repository, currently in my config server i have provided the URI and default-label: trunk and i have application specific property under trunk. below is the contents of my consuming application's application.yml and able to pull the properties successfully

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

现在,我在另一个文件夹中拥有一个共享属性,该文件夹也跨其他应用程序共享,那么如何将其与特定于我的应用程序一起加载到我的应用程序中?

now i have a shared property in different folder thats shared across other applications as well, so how do i load this into my application along with my application specific

推荐答案

您可以在根目录中创建一个常规application.yml

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

在此处查看示例配置仓库:
https://github.com/spring-cloud-samples/config-repo

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

这是一个示例消费者
https://github.com/spring-cloud-samples/customers-stores/blob/master/rest-microservices-store/src/main/resources/bootstrap.yml

客户商店项目将从回购中的application.yml和stores.yml中读取。

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

,检查/ env URL(如果已添加执行器),并且应该会看到两个configService条目

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

这篇关于用配置服务器加载多个属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆