简体   繁体   English

如果 git 是版本控制,如何将 spring 云配置服务器指向由客户端决定的文件夹

[英]how to point spring cloud config server to a folder decided by client if git is the version control

Am trying spring cloud config server and client as stand-alone separate applications.我正在尝试将 spring 云配置服务器和客户端作为独立的独立应用程序。

on git, i have folder structure like below-在 git 上,我的文件夹结构如下 -

my-config我的配置
----projectfolder1 ----项目文件夹1
--------application.properties --------application.properties
----projectfolder2 ----项目文件夹2
--------application.properties --------application.properties

I would like that spring cloud client named "projectfolder1" should search我希望名为“projectfolder1”的 spring 云客户端应该搜索
application.properties within projectfolder1 on git from spring cloud server ie git 上 projectfolder1 中的 application.properties 来自 spring 云服务器,即
----projectfolder1 ----项目文件夹1
--------application.properties --------application.properties

and client "projectfolder2" should get the below mentioned properties from spring cloud config server和客户端“projectfolder2”应该从 spring 云配置服务器获取下面提到的属性
----projectfolder2 ----项目文件夹2
--------application.properties --------application.properties

My Spring Cloud Config server application.properties has- spring.cloud.config.server.git.search-paths='{application}'我的 Spring 云配置服务器 application.properties 有- spring.cloud.config.server.git.search-paths='{application}'

projectfolder1 in its bootstrap.properties has spring.application.name=projectfolder1 projectfolder1 在其 bootstrap.properties 中有 spring.application.name=projectfolder1

and projectfolder2 in its bootstrap.properties has spring.application.name=projectfolder2并且 projectfolder2 在其 bootstrap.properties 中具有 spring.application.name=projectfolder2

According to spring cloud config documentation '{application}' in search path should find the files within the "resolved application name" folder on git.根据 spring 云配置文档 '{application}' 在搜索路径中应该找到 git 上“已解析的应用程序名称”文件夹中的文件。 But the above '{application}' doesn't work for me.但是上面的“{application}”对我不起作用。 Clients projectfolder1 and projectfolder2 are not able to get any property at all.客户 projectfolder1 和 projectfolder2 根本无法获得任何属性。

pls assist.请协助。 i know its possible duplicate of another question on stack overflow.我知道它可能与堆栈溢出的另一个问题重复。 but that question is not resolved and i do not have rights to comment on any question being a new user, So i created this as another question here.但是这个问题还没有解决,作为新用户,我无权评论任何问题,所以我在这里创建了另一个问题。

I solved it myself.我自己解决了。 The trick is to give search-path {application} without quotes as given below.诀窍是给 search-path {application} 不带引号,如下所示。 It was a little tricky as spring documentation mentions it as '{application}', probably spring developers just wanted to highlight it with quotes.这有点棘手,因为 spring 文档将其称为“{应用程序}”,可能 spring 开发人员只是想用引号突出显示它。

spring.cloud.config.server.git.search-paths={application} spring.cloud.config.server.git.search-paths={应用程序}
instead of spring.cloud.config.server.git.search-paths='{application}'而不是 spring.cloud.config.server.git.search-paths='{application}'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Cloud Config Server-设置克隆git repo的文件夹的目录 - Spring cloud config server -Set directory of folder where git repo are cloned 当 Spring Security 在 Spring Cloud Config Server 上处于活动状态时,Spring Cloud Config Client 不获取配置 - Spring Cloud Config Client not fetching config when Spring Security is active on Spring Cloud Config Server 如果配置服务器关闭,Spring Cloud 配置客户端会加载本地属性 - Spring cloud config client load local properties if the config server is down Spring 云配置服务器未从 git 提取最新提交 - Spring cloud Config server not pulling latest commit from git 无法在 Spring 云配置服务器中从 GIT 读取属性源 - Unable to read property source from GIT in Spring cloud config server 将 spring 云配置服务器连接到本地 git 存储库失败 - connecting spring cloud config server to local git repo failed Spring Cloud Config Client 未从服务器自动获取配置 - Spring Cloud Config Client is not fetching automatically configuration from server Spring Cloud Config客户端配置刷新不起作用 - spring cloud config client config refresh not working 如何将Spring Cloud Config与Git and Vault复合环境存储库一起使用? - How to use Spring Cloud Config with a Git and Vault composite environment repository? Spring Boot和Spring Cloud配置客户端错误 - Spring boot and spring cloud config client error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM