It appears that now unless I explicitely set spring.cloud.config.discovery.enabled=true, Consul config fails because it gets a null ConsulClient Bean.
10:22:03.476 [main] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.context.config.ConfigDataResourceNotFoundException: Config data resource '[ConsulConfigDataResource@584f54e6 context = 'config/application,dev/', optional = true, properties = [ConsulConfigProperties@5d8bafa9 enabled = true, prefixes = list['config'], defaultContext = 'application', profileSeparator = ',', format = KEY_VALUE, dataKey = 'data', aclToken = [null], watch = [ConsulConfigProperties.Watch@576f63f6 waitTime = 55, enabled = true, delay = 1000], failFast = true, name = 'application'], profile = 'dev']' via location 'consul:localhost:8500' cannot be found
at org.springframework.boot.context.config.ConfigDataResourceNotFoundException.withLocation(ConfigDataResourceNotFoundException.java:97)
at org.springframework.boot.context.config.ConfigDataImporter.handle(ConfigDataImporter.java:145)
at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:136)
at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:86)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:121)
at org.springframework.boot.context.config.ConfigDataEnvironment.processWithProfiles(ConfigDataEnvironment.java:311)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:232)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:102)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:94)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82)
at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:117)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:111)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:62)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:374)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:332)
at com.lyra.payapp.vulcain.sample.SampleApplication.main(SampleApplication.java:17)
Caused by: org.springframework.cloud.consul.config.ConsulPropertySources$PropertySourceNotFoundException: java.lang.IllegalArgumentException: Property source must not be null
at org.springframework.cloud.consul.config.ConsulPropertySources.createPropertySource(ConsulPropertySources.java:143)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.doLoad(ConsulConfigDataLoader.java:66)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.load(ConsulConfigDataLoader.java:57)
at org.springframework.cloud.consul.config.ConsulConfigDataLoader.load(ConsulConfigDataLoader.java:38)
at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:107)
at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:128)
... 21 common frames omitted
Caused by: java.lang.IllegalArgumentException: Property source must not be null
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.core.env.PropertySource.<init>(PropertySource.java:76)
at org.springframework.core.env.EnumerablePropertySource.<init>(EnumerablePropertySource.java:53)
at org.springframework.cloud.consul.config.ConsulPropertySource.<init>(ConsulPropertySource.java:56)
at org.springframework.cloud.consul.config.ConsulPropertySources.create(ConsulPropertySources.java:154)
at org.springframework.cloud.consul.config.ConsulPropertySources.createPropertySource(ConsulPropertySources.java:134)
... 26 common frames omitted
I don't understand why this property is becoming required?
Hi,
I'm trying to migrate:
Spring Boot 2.4.5
+Spring Cloud 2020.0.1
Spring Boot 2.5.2
+Spring Cloud 2020.0.3
It appears that now unless I explicitely set
spring.cloud.config.discovery.enabled=true
, Consul config fails because it gets a null ConsulClient Bean.I don't understand why this property is becoming required?
My issue seems to be related to this commit (the method
isDiscoveryEnabled
is returningfalse
)