Describe the bug
With the native
profile active, the health status according to org.springframework.cloud.config.server.config.ConfigServerHealthIndicator
is UP
, even when the Environment
that it finds has no property sources.
An API request for the same name
and profiles
that the health indicator uses returns 404 Not Found
when spring.cloud.config.server.accept-empty
is false
. I would expect the health indicator to respect the value of spring.cloud.config.server.accept-empty
and return DOWN
when the Environment
has no property sources.
Spring Boot: 3.4.2 Spring Cloud: 2024.0.0
Sample https://github.com/cselagea/spring-cloud-config-health-empty-env
Comment From: ryanjbaxter
The issue here is that the logic around accept-empty
is contained within EnvironmentController
not within the EnvironmentRepository
implementations which is used by the config server health check.
https://github.com/spring-cloud/spring-cloud-config/blob/4742859c12f9c8dfb9489d718d15a8e66536e343/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java#L130-L145
The first thing to point out is that if we change this behavior it will be a breaking change.
I would like to discuss this with the team to get more opinions about this behavior.
Comment From: cselagea
Thanks for the quick turnaround on this issue, @ryanjbaxter.
I tried Spring Boot 3.5.0-M2 and Spring Cloud 2025.0.0-M2, but the test from my sample project is still failing.
Shouldn't the health indicator check whether there are any property sources so that it's consistent with how EnvironmentController
works?
https://github.com/spring-cloud/spring-cloud-config/blob/ed6a88ea185455ab41fa39999f8589f06b0a811c/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/ConfigServerHealthIndicator.java#L115-L119
https://github.com/spring-cloud/spring-cloud-config/blob/ed6a88ea185455ab41fa39999f8589f06b0a811c/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/EnvironmentController.java#L135-L137