Closed aoudiamoncef closed 3 years ago
See https://github.com/spring-cloud/spring-cloud-consul/issues/692#issuecomment-758168908
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.
Hi @spencergibb, I'll try to reproduce the issue ASAP on a small project.
HI @spencergibb
I am having a similar problem and I've reproduced what @aoudiamoncef is describing in https://github.com/fkohantorabi/ConsulBugReport300. Please take a look. Feel free to play around with spring.config.import since there are multiple scenarios you can end up with.
@fkohantorabi so your reproducer doesn't have the same exception as reported.
java.lang.IllegalArgumentException: Source must not be null
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.boot.context.properties.source.SpringConfigurationPropertySource.from(SpringConfigurationPropertySource.java:145)
at org.springframework.boot.context.properties.source.ConfigurationPropertySource.from(ConfigurationPropertySource.java:96)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributor.ofUnboundImport(ConfigDataEnvironmentContributor.java:313)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.lambda$asContributors$1(ConfigDataEnvironmentContributors.java:172)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
at java.base/java.util.Collections$UnmodifiableMap.forEach(Collections.java:1505)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.asContributors(ConfigDataEnvironmentContributors.java:163)
at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors.java:123)
at org.springframework.boot.context.config.ConfigDataEnvironment.processWithProfiles(ConfigDataEnvironment.java:305)
at org.springframework.boot.context.config.ConfigDataEnvironment.processAndApply(ConfigDataEnvironment.java:230)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:97)
at org.springframework.boot.context.config.ConfigDataEnvironmentPostProcessor.postProcessEnvironment(ConfigDataEnvironmentPostProcessor.java:89)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:100)
at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:86)
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:1540)
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:362)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at com.spring.bugreport.ConsulBug.ConsulBugApplication.main(ConsulBugApplication.java:10)
@spencergibb the exception you posted is what you get If you have spring.config.import=optional:consul:/dev
. If you change it to spring.config.import=consul:/dev
you will see the error @aoudiamoncef has reported. Apologies for the confusion.
Hi,
application.yml:
Consul:
At startup, I got:
Workaround:
I tried another configuration without success:
Related to issue #692
Thanks