diff --git a/spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java b/spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java index 981493929..6ba3cc47b 100644 --- a/spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java +++ b/spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.boot.DefaultPropertiesPropertySource; +import org.springframework.boot.context.properties.source.ConfigurationPropertySources; import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration; import org.springframework.cloud.context.environment.EnvironmentChangeEvent; import org.springframework.cloud.context.scope.refresh.RefreshScope; @@ -52,16 +54,21 @@ public abstract class ContextRefresher { protected static final String REFRESH_ARGS_PROPERTY_SOURCE = "refreshArgs"; + /** + * see {@link ConfigurationPropertySources#ATTACHED_PROPERTY_SOURCE_NAME}. + */ + private static final String ATTACHED_PROPERTY_SOURCE_NAME = "configurationProperties"; + protected static final String[] DEFAULT_PROPERTY_SOURCES = new String[] { // order matters, if cli args aren't first, things get messy - CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME, "defaultProperties" }; + CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME, DefaultPropertiesPropertySource.NAME }; protected Set standardSources = new HashSet<>( Arrays.asList(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME, StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME, StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME, - StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, "configurationProperties")); + StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, ATTACHED_PROPERTY_SOURCE_NAME)); protected final List additionalPropertySourcesToRetain;