I am learning Spring Cloud Config v3.0.5. When I was studying in the
However, when i set spring.cloud.config.label=dev and visit http://localhost:3344/config-dev.yml, i still get the data on master branch.
So what does the property spring.cloud.config.label do? And what does "align the config label with your branch" mentioned in the document mean?
CodePudding user response:
The property spring.cloud.config.label
can be used in the client application, not in the config server.
I assume that you use a git backend for your config server. To get a config that has the label dev
, you need to create a branch or tag in the git repository that contains the config. The mechanism for other backends can be looked up in the reference documentation.
After creating the branch, the URLs should work as expected. But please note that the URL http://localhost:3344/config-dev.yml
refers to an application called config
and a profile (not a label) dev
. The default profile of a Spring application is default
and one of many ways to set it on a client is with the property spring.profiles.active
.
I agree that the word align
in the reference documentation is unclear. I think they suggest to create branches in the config repository for feature branch development and use the same branch name for both the config and the code repository, respectively. Then you can set the label to the branch name in the feature branch of the client's code repository.