You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have many services they should use Spring Cloud Config.
To avoid adding same part of config to properties to all service, I've created submodule in project with such config:
Then added this library as dependency to service and imported its config via @Import(CommonCloudConfigConfiguration.class)
But it seems like that cloud config client is initializing too early, so imported config that brings additional properties file via @PropertySource(value = "classpath:cloud-config-properties-dev.yml", factory = YamlPropertySourceFactory.class, ignoreResourceNotFound = true) doesn't have time to populate the PropertySource.
And as result I get exception:
15:30:53.556 [main] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.cloud.commons.ConfigDataMissingEnvironmentPostProcessor$ImportException: No spring.config.import set
at org.springframework.cloud.commons.ConfigDataMissingEnvironmentPostProcessor.postProcessEnvironment(ConfigDataMissingEnvironmentPostProcessor.java:82)
Should such case be working ?
The text was updated successfully, but these errors were encountered:
No, I'm afraid not. As mentioned in the reference documentation, @PropertySource annotations aren't processed until we begin creating the application context. This is too late for spring.config.import to be found and processed. You'll have to use an EnvironmentPostProcessor registered in spring.factories to add the shared configuration to the environment. We'd like to make this easier and #24688 is tracking that work.
I have many services they should use Spring Cloud Config.
To avoid adding same part of config to properties to all service, I've created submodule in project with such config:
Then added this library as dependency to service and imported its config via
@Import(CommonCloudConfigConfiguration.class)
But it seems like that cloud config client is initializing too early, so imported config that brings additional properties file via
@PropertySource(value = "classpath:cloud-config-properties-dev.yml", factory = YamlPropertySourceFactory.class, ignoreResourceNotFound = true)
doesn't have time to populate the PropertySource.And as result I get exception:
Should such case be working ?
The text was updated successfully, but these errors were encountered: