Application tries to reach out to config server even when its disabled
Create a new application from start.spring.io. Include Spring Cloud Config Client.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
Disable spring.cloud.config.
spring:
cloud:
config:
enabled: false
In logs I see
2017-10-26 18:01:24.715 INFO 9480 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
2017-10-26 18:01:26.428 WARN 9480 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: label not found
I think this is causing #104 for me.
I think the problem is this property is completely ignored.
In
ConfigServiceBootstrapConfiguration
@Bean
@ConditionalOnMissingBean(ConfigServicePropertySourceLocator.class)
@ConditionalOnProperty(value = "spring.cloud.config.enabled", matchIfMissing = true)
public ConfigServicePropertySourceLocator configServicePropertySource(ConfigClientProperties properties) {
ConfigServicePropertySourceLocator locator = new ConfigServicePropertySourceLocator(
properties);
return locator;
}
shouldn't it be
@Bean
@ConditionalOnMissingBean(ConfigServicePropertySourceLocator.class)
@ConditionalOnProperty(value = "spring.cloud.config.enabled", matchIfMissing = true, havingValue="true")
public ConfigServicePropertySourceLocator configServicePropertySource(ConfigClientProperties properties) {
ConfigServicePropertySourceLocator locator = new ConfigServicePropertySourceLocator(
properties);
return locator;
}
Makes sense, want to submit a PR?
@ryanjbaxter The problem still exists. I wanted to make a PR but see now that ConfigServicePropertySourceLocator has no @Conditional annotation. Does it mean that it can not be configured at all?
Is it possible to use spring-boot-starter-actuator with health check without config servers?
Both conditionals still exist as far as I can see https://github.com/spring-cloud/spring-cloud-config/blob/6710237c1080df1c1a776eb27768696b2582ca8f/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServiceBootstrapConfiguration.java#L54
Is there a way to disable config server? Face the same issue in 2.0.4
Nothing has changed.
The same problem even I use bootstrap.yml as config file, Spring Could 1.5.9
If I run as java -cp com.company.package.jar:./lib/* com.company.package.MainClass or compile with Class-Path in MANIFEST.MF file then run as java -jar com.company.package.jar then this problem fixed, so you should check properties file name and class path.
Just realized that this property needs to be set in bootstrap.yml not application.yml. Can you try that and let us know?
Hi @ryanjbaxter ,
I tried spring.cloud.config.enabled=false in bootstrap.properties, the client is still looking for config server. And I am using custom-rest-template
spring-cloud-starter-config: 2.0.2.RELEASE
@AndrewLaBabies if you are using custom bootstrap config, it will need to be @ConditionalOnProperty("spring.cloud.config.enabled"). I was unable to recreate the problem you are having. Setting that property disabled config client.
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
Thanks @spencergibb , I applied @ConditionalOnProperty("spring.cloud.config.enabled") on the configuration class (contains bean ConfigServicePropertySourceLocator), it works now. The client stopped finding config server. Thanks.
Thanks for following up.