[英]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.