spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java
/**
	 * Attach a {@link ConfigurationPropertySource} support to the specified
	 * {@link Environment}. Adapts each {@link PropertySource} managed by the environment
	 * to a {@link ConfigurationPropertySource} and allows classic
	 * {@link PropertySourcesPropertyResolver} calls to resolve using
	 * {@link ConfigurationPropertyName configuration property names}.
	 * <p>
	 * The attached resolver will dynamically track any additions or removals from the
	 * underlying {@link Environment} property sources.
	 * @param environment the source environment (must be an instance of
	 * {@link ConfigurableEnvironment})
	 * @see #get(Environment)
	 */
Attach a  ConfigurationPropertySource support to the specified
Environment. Adapts each  PropertySource managed by the environment
to a  ConfigurationPropertySource and allows classic
PropertySourcesPropertyResolver calls to resolve using
ConfigurationPropertyName configuration property names.

The attached resolver will dynamically track any additions or removals from the
underlying  Environment property sources.
@param environment the source environment (must be an instance of
ConfigurableEnvironment)
@see #get(Environment)
Attach a ConfigurationPropertySource support to the specified Environment . Adapts each PropertySource managed by the environment to a ConfigurationPropertySource and allows classic PropertySourcesPropertyResolver calls to resolve using ConfigurationPropertyName configuration property names . The attached resolver will dynamically track any additions or removals from the underlying Environment property sources . @param environment the source environment ( must be an instance of ConfigurableEnvironment ) @see #get ( Environment )
public static void attach(Environment environment) {
		Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
		MutablePropertySources sources = ((ConfigurableEnvironment) environment).getPropertySources();
		PropertySource<?> attached = getAttached(sources);
		if (attached != null && attached.getSource() != sources) {
			sources.remove(ATTACHED_PROPERTY_SOURCE_NAME);
			attached = null;
		}
		if (attached == null) {
			sources.addFirst(new ConfigurationPropertySourcesPropertySource(ATTACHED_PROPERTY_SOURCE_NAME,
					new SpringConfigurationPropertySources(sources)));
		}
	}
public static void attach ( Environment environment ) { Assert . isInstanceOf ( ConfigurableEnvironment . class , environment ) ; MutablePropertySources sources = ( ( ConfigurableEnvironment ) environment ) . getPropertySources ( ) ; PropertySource < ? > attached = getAttached ( sources ) ; if ( attached != null && attached . getSource ( ) != sources ) { sources . remove ( ATTACHED_PROPERTY_SOURCE_NAME ) ; attached = null ; } if ( attached == null ) { sources . addFirst ( new ConfigurationPropertySourcesPropertySource ( ATTACHED_PROPERTY_SOURCE_NAME , new SpringConfigurationPropertySources ( sources ) ) ) ; } }
Attach a {@link ConfigurationPropertySource} support to the specified
 {@link Environment}.
Attach a { @link ConfigurationPropertySource } support to the specified { @link Environment } .