Configuration parsing SpringBoot is achieved through Environment.
Environment itself implements PropertyResolver interface will eventually entrusted to PropertySourcesPropertyResolver to resolve configuration.
org.springframework.core.env.PropertySourcesPropertyResolver.getProperty
1 protected <T> T getProperty(String key, Class<T> targetValueType, boolean resolveNestedPlaceholders) { 2 if (this.propertySources != null) { 3 for (PropertySource<?> propertySource : this.propertySources) { // 1. 循环 PropertySources 4 if (logger.isTraceEnabled()) { 5 logger.trace("Searching for key '" + key + "' in PropertySource '" + 6 propertySource.getName() + "'"); 7 } 8 Value = propertySource.getProperty Object (key); // 2. acquired from the key corresponding to the configuration in PropertySource . 9 IF (value =! Null ) { 10 IF (&& value resolveNestedPlaceholders the instanceof String) { . 11 value = resolveNestedPlaceholders ((String) value ); // 3. analytical placeholder {} $ 12 is } 13 is logKeyFound (Key, propertySource, value); 14 return convertValueIfNecessary (value, targetValueType); // 4. converted into the specified type 15 } 16 } 17 } 18 if (logger.isTraceEnabled()) { 19 logger.trace("Could not find key '" + key + "' in any property source"); 20 } 21 return null; 22 }