请帮助我解决以下问题。我希望git repo中的每个微服务都有一个文件夹。请参考我在git repo中的示例结构。https://github.com/tech-vishesh/config-server_properties
If we have same properties under different folder
like
ms-one
|--- application.properties
|--- application-prod.properties
|--- application-dev.properties
ms-two
|--- application.properties
|--- application-prod.properties
|--- application-dev.properties
we have define search path in spring cloud config bootstrap file
spring.cloud.config.server.git.search-paths=ms-one,ms-two
Now we have to load profile in client application then how we can load the profile?
I have define
spring.application.name=application
spring.profiles.active=dev
but how to define which folder.
Current spring boot version 2.2.5发布于 2020-04-19 10:51:09
这是可以解决的。诀窍是给出不带引号的搜索路径{application},如下所示。这有点棘手,因为spring文档提到它是'{application}‘,可能spring开发人员只是想用引号来突出它。
在spring云服务器中添加下面提到的搜索路径-
spring.cloud.config.server.git.search-paths={application}而不是
spring.cloud.config.server.git.search-paths='{application}'这会将搜索路径(在服务器端)设置为与客户端应用程序名称相同的名称。
现在,如果您的微服务/应用程序-它们应该具有如下所示的spring.application.name -
spring.application.name=ms-one和
spring.application.name=ms-two 他们将查看它们各自的文件夹ms-one和ms-two中的属性文件。
发布于 2020-03-04 00:07:38
您需要为Spring Cloud Config Server设置next属性
spring.cloud.config.server.git.search-paths='{application}'在这种情况下,您的客户端应用程序名称将用作文件夹的搜索路径。
发布于 2021-03-11 21:36:45
指向git代码库,并在searchPaths中设置子文件夹
spring.cloud.config.server.git.uri=https://github.com/sarat9/config-server-spring-boot
spring.cloud.config.server.git.searchPaths=config-repohttps://stackoverflow.com/questions/60500158
复制相似问题