We are leveraging Spring Cloud Config and Spring Cloud Config Vault. We would like to know if there is a way to "bootstrap the bootstrap", ie we want spring cloud config server to be hit and then pull properties from that to leverage in our vault configuration. We looked at order, but it didn't appear to work, and I assume it is because of the post processing order, but I was hoping I might be missing something.
It doesn't work.
What Spring Cloud does with its bootstrap context, is setting up an application context that contains a set of PropertySource
s initialized from Spring beans. The bootstrap context is used then as parent context for the actual context created by Spring Boot. A property lookup looks for properties in its own context and within the parent context.
Configuration properties are initialized very early in the startup process and they use properties from the current Environment
. At the time ConfigurationProperties
beans are initialized, the Environment
does not yet contain any remote PropertySource
s.
The only option I see here (except creating a bootstrap-bootstrap-context) is using the Spring Cloud Config client within your main
class and contribute Vault properties before any Spring context is built.