When including spring-cloud-starter-netflix-ribbon 2.2.1 (or 2.2.3) into a project with spring boot (tested with 2.2.7 & 2.3.1) the spring.application.name is resolved to null in ContextIdApplicationContextInitializer#getApplicationId because the parent context does not include the application.yml as propertysource. The Initializier is called twice with a context containing the application.yml as property source but due to if (parent != null && parent.containsBean(ContextId.class.getName())) the parent context id is returned which is application-1 because spring.application.name was null during the initialization of the parent. Maybe there are other impacts as well maybe not but I think this is not intented.
Comment From: spencergibb
bootstrap causes this. It is no longer on by default in spring cloud 2020.0 (spring cloud netflix 3.0.x), but ribbon is also no longer supported. You can try setting spring.cloud.bootstrap.enabled=false, but that disables things like config client if you are using that.
Comment From: spring-cloud-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: Chr3is
@spencergibb Thanks for the answer. We removed ribbon and do not face this issue anymore. This ticket can be closed since there's an existing solution to disable bootstrap and ribbon is already deprecated.