spring.config.location探究

65 阅读1分钟

org.springframework.boot.context.config.ConfigFileApplicationListener

private Set<String> getSearchLocations() {
   Set<String> locations = getSearchLocations(CONFIG_ADDITIONAL_LOCATION_PROPERTY);
   if (this.environment.containsProperty(CONFIG_LOCATION_PROPERTY)) {
      locations.addAll(getSearchLocations(CONFIG_LOCATION_PROPERTY));
   }
   else {
      locations.addAll(
            asResolvedSet(ConfigFileApplicationListener.this.searchLocations, DEFAULT_SEARCH_LOCATIONS));
   }
   return locations;
}

详细查看加载的配置文件,通过配置log输出使用到的配置文件。

logging:
  level:
    org.springframework.boot.context.config.ConfigFileApplicationListener: trace