Hi colleagues, Either I do not understand (please correct me if this this the case and I will raise the question in StackOverflow) or there is undocumented/incompletely documented feature. We created some custom auto-configuration within a library (non Spring Boot app), which needs to be available before the user's application's beans initialization (e.g. this auto-configuration adds additional property source to the Spring environment). The mentioned user's application is Spring Boot app, which has that library as dependency in maven pom (besides the other required dependencies like spring-cloud-starter, spring-cloud-config-client, spring-cloud-starter-netflix-eureka-client of version 3.1.1 etc). To accomplish this the mentioned auto-configuration in the library is put under org.springframework.cloud.bootstrap.BootstrapConfiguration key in spring.factories. However it also relies on some config properties from Spring Config Server. So downloading the configuration from the Spring Config Server have to happen at the very beginning of the context initialization (bootstrap phase). Which is actually validly expected behavior as per https://cloud.spring.io/spring-cloud-static/spring-cloud.html#_application_context_hierarchies. It occurs in the expected sequence (1. config from the Config Server; 2. config from bootstrap.properties file) if we specify config server in the user's application directly using "spring.config.import=optional:configserver:somehost" property. If we communicate with the Config Server via Eureka discovery service as per https://cloud.spring.io/spring-cloud-config/reference/html/#discovery-first-bootstrap the configuration loading sequence is changed to 1. Config from bootstrap.properties file, 2. config from the Config Server. Moreover, still in this "Discovery First Lookup" mode if we put just empty "spring.config.import=optional:configserver:" the Config Server address is properly picked up from Eureka and the config from it is downloaded first (which is what we need). We have doubts of relying on this approach to guarantee the required config loading order because it is not described in https://cloud.spring.io/spring-cloud-config/reference/html/#discovery-first-bootstrap. Bu it is mentioned in another official doc page https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#discovery-first-bootstrap. So could you advise please if we can rely on this approach (specifying spring.config.import) to guarantee the loading from the Config Server happens first (before initialization of props from bootstrap file) in "Discovery First Lookup" mode?

Comment From: ryanjbaxter

You do not want to use spring.config.import in this case you want to use config first bootstrap I think https://github.com/spring-cloud/spring-cloud-config/blob/main/docs/src/main/asciidoc/spring-cloud-config.adoc#config-first-bootstrap

Comment From: timothy-khom

@ryanjbaxter it is the approach - discovery services in Eureka instead of direct connection - we use in our company, so config first bootstrap way is not suitable for us. We need both at the same time: communicating with Config Server happens via Discovery Service and loading config from the Config Server occurs at the very beginning

Comment From: ryanjbaxter

The documentation at https://cloud.spring.io/spring-cloud-config/reference/html/#discovery-first-bootstrap is not the most current documentation (see the version number at the top of the docs...I assume you found it via Google). The current documentation is at this URL https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#discovery-first-bootstrap. You can make sure that discovery lookup occurs during the bootstrap phase by using config first bootstrap and enabling discovery first lookup.

Comment From: timothy-khom

Good catch regarding the version. So it seems it is official recommendation to use spring.config.import=optional:configserver: in Discovery First mode and we can rely on it

Comment From: ryanjbaxter

I think what you want to do is use Config First Bootstrap https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#config-first-bootstrap

And then enable Discovery First Lookup https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#discovery-first-bootstrap

Comment From: timothy-khom

make sense. Thank you