1 year ago
#375178
Mark
Include dependency properties through Spring Cloud Config server
We currently have a Maven multi-module setup of various commons modules and other standalone applications, which would depend on commons / other modules. All modules would have a default set of properties to enable/disable certain functionality, including the commons modules.
These commons properties can be overridden by properties files in one of the modules that has commons as a dependency (We have a custom setup for combining/overriding these properties which is quite intricate but results in a completely merged set of properties for the Spring environment to use)
I have been looking into Spring Cloud Config as an alternative to completely externalize our configuration from our codebase, but I can't see an easy/automatic way to combine these properties together for a module and it's dependencies.
What I have seen so far is that I could use spring.config.import=
in my {application-name}.properties
files to include the required properties from all of the dependencies (and their dependencies in some cases), but this would mean I would need to have multiples of these import statements in the properties file to ensure all properties from all dependencies are included in the final application.
I could also set spring.application.name
to a comma separated list in the client application in order to access all of the properties I need, but again this would be a list of dependency names which would be difficult to manage. I've figured that I can use the profiles to switch between the likes of dev and prod-specific properties files for an application which is quite interesting, but my issue is more of an inheritance of properties instead of switching.
I'm not aware if this approach is covered by Spring Cloud Config, or if I've completely missed something?
spring-cloud-config
spring-cloud-config-server
0 Answers
Your Answer