Search code examples
spring-cloudspring-cloud-config

Why spring cloud config client loads its Configuration in bootstrap


I am currently developing a custom config client like spring cloud config client. The reason for that is that there are some special cases that spring cloud config client does not cover for my special case.

For that, like spring cloud config client, I am using spring cloud context. As I see, spring cloud config client loads its configuration in the bootstrap phase, but I do not see the reason for that.

In my custom config client, if I load the configuration with a normal autoconfiguration of SpringBoot works well. I am just adding a custom property source to the spring Environment.

So, anybody knows the reason of why spring-cloud-config-client loads its configuration in the bootstrap phase? I am afraid of I am missing something.


Solution

  • Finnally I have got the answer.

    If the load of the custom property sources are created in the same context of the application, there may be cases where the beans of the application can be loaded before that the custom property sources. Above all, if there is no implicit dependency between the bean that needs the configuration and the custom property source.

    It it happens, those beans will not get the configurations from the custom property sources.