I am trying set Spring Cloud Config Server, but the service config server, it the running on port 8888 which is correct, and another service should run on port 18060, but for reason when I startup, it allocate port 8080 for me and the return a warning "Could not locate PropertySource: label not found", what should I do? Thank you !!!
-
Take a look at this [question](http://stackoverflow.com/questions/28375416/spring-cloud-config-server-cant-locate-propertysource-on-startup) it may help – Fady Saad May 17 '17 at 02:44
-
tried it, but still not working – Joseph T May 17 '17 at 03:30
-
1@JosephT . Were you able to solve this ? I am also facing the same issue. – Débora Dec 28 '17 at 07:05
-
I had same issue. Turned out that the config server was not configured yet with a repository. After filling out the default configuration and restaging, the app listed the labels and loaded the property files. – austin cherlo Dec 02 '19 at 23:25
8 Answers
Add @EnableConfigServer at configuration class level or main class of spring boot application and restart the service .it will work .

- 71
- 1
- 1
In my case it was because I had to set the default branch of my github URI (the branch of the repository set for spring.cloud.config.server.git.uri) in the config server by setting the following to the application.properties
spring.cloud.config.server.git.default-label=main

- 1,257
- 1
- 8
- 17
I ran into similar issue, when I run my server locally I see in the logs only on the stratup
o.s.c.c.c.ConfigServicePropertySourceLocator - Could not locate PropertySource: label not found
It turned out this is a problem with the health check for the config server, when health check is triggered to config server an empty environment is used so the application name is empty hence the spring cloud client will try to access {config-server}/application since application is the default application name, see issue for more info on this.
To solve the issue I just disabled the health check for config server
health.config.enabled=false

- 6,412
- 3
- 20
- 43
Try this one. I had the same issue and solved.
First enable debug mode in your app.(In your property file: logging.level.=DEBUG . This is only to make sure the issue is same as mine Or you may have any clue of where it can go wrong.)
Then start the application and see the logs. The log shows the configured server URI and what the URL to get all property resources.
Compare both URL s - the one in the log and your Configuration server URI.
Issue is that mistakenly the URL defined the property file can have empty space at the end. (This can happen when you copy past from somewhere ) Example:
the value for spring.cloud.config.uri=http:localhost:< port >< additional empty space >
If this is the case, the client's log shows localhost:/20%20%/ < app name > / < profile >
Simply remove the post empty space. Then it should work !

- 170
- 2
- 12
In your bootstrap.yml file Add these lines
spring:
cloud:
config:
enabled: true
uri: http://localhost:8888 ##this is the link to the server config
label: main ##this is what you are missing (name of the git repo branch)
application:
name: currency-spring-cloud-config-client
profiles:
active: testing
server:
port: 8600
spring:
cloud:
config:
enabled: true
uri:
- http://localhost:9196 ### your port for cloud config server
label: main ### your git repo branch name

- 1
- 1
-
This assumes you are doing config first not discovery first with your config server – B Randall Oct 20 '21 at 13:55
In my case my server was fetching cofnigs from github repository, and I forgot that I made it private :)

- 129
- 1
- 8
Mostly it is due to typo in url. In my case it was due to wrong url typing:
spring:
application:
name: employee-service
config:
import: "optional:configserver:http:/localhost:8088" < Wrong_url>
Not able to connect the config-server <<<<<<
=========================================================================
spring:
application:
name: employee-service
config: import: "optional:configserver:http://localhost:8088" <right_url>
So, able to connect the config-server. <<<<<<

- 3,833
- 1
- 24
- 14