I'm using org.springframework.cloud:spring-cloud-config-server:3.1.0
According to the doc https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_quick_start The HTTP service has resources in the following form:
/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties
For example:
curl localhost:8888/foo/development
curl localhost:8888/foo/development/master
curl localhost:8888/foo/development,db/master
curl localhost:8888/foo-development.yml
curl localhost:8888/foo-db.properties
curl localhost:8888/master/foo-db.properties
But when I use curl localhost:8888/master/foo-db.properties
I got:
{"name":"master","profiles":["foo-db.properties"],"label":null,"version":"52ba55eecc7239f2a24f529eccf640befc34a6d9","state":null,"propertySources":[]}
That means the service take "master" as {application} instead of {label} and take "foo-db.properties" as {profile} not {application}-{profile}.properties
It seems that pattern /{label}/{application}-{profile}.properties
have be overridden by pattern /{application}/{profile}[/{label}]
Comment From: woshikid
In spring-cloud-config-server:3.1.0 org.springframework.cloud.config.server.environment.EnvironmentController has @GetMapping(path = "/{name}/{profiles:.*[^-].*}", produces = MediaType.APPLICATION_JSON_VALUE)
I think that's the regex caused the problem. I guess it want to exclude the pattern {application}-{profile}.properties
but .*[^-].*
still matches "foo-db.properties"
. I think [^-]*
or [^\\.]*
may solve the problem.
Comment From: woshikid
It is fixed by later release, just need to simplify