Skip to content

Commit 272c93e

Browse files
committed
Refer to PropertySource names in Spring Boot
Signed-off-by: Yanming Zhou <[email protected]>
1 parent 7e1cbf8 commit 272c93e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,8 @@
2727
import org.apache.commons.logging.Log;
2828
import org.apache.commons.logging.LogFactory;
2929

30+
import org.springframework.boot.DefaultPropertiesPropertySource;
31+
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
3032
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
3133
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
3234
import org.springframework.cloud.context.scope.refresh.RefreshScope;
@@ -52,16 +54,21 @@ public abstract class ContextRefresher {
5254

5355
protected static final String REFRESH_ARGS_PROPERTY_SOURCE = "refreshArgs";
5456

57+
/**
58+
* see {@link ConfigurationPropertySources#ATTACHED_PROPERTY_SOURCE_NAME}.
59+
*/
60+
private static final String ATTACHED_PROPERTY_SOURCE_NAME = "configurationProperties";
61+
5562
protected static final String[] DEFAULT_PROPERTY_SOURCES = new String[] {
5663
// order matters, if cli args aren't first, things get messy
57-
CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME, "defaultProperties" };
64+
CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME, DefaultPropertiesPropertySource.NAME };
5865

5966
protected Set<String> standardSources = new HashSet<>(
6067
Arrays.asList(StandardEnvironment.SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME,
6168
StandardEnvironment.SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME,
6269
StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME,
6370
StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME,
64-
StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, "configurationProperties"));
71+
StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME, ATTACHED_PROPERTY_SOURCE_NAME));
6572

6673
protected final List<String> additionalPropertySourcesToRetain;
6774

0 commit comments

Comments
 (0)