Search in sources :

Example 1 with OriginTrackedResource

use of org.springframework.boot.origin.OriginTrackedResource in project spring-boot by spring-projects.

the class StandardConfigDataLoader method load.

@Override
public ConfigData load(ConfigDataLoaderContext context, StandardConfigDataResource resource) throws IOException, ConfigDataNotFoundException {
    if (resource.isEmptyDirectory()) {
        return ConfigData.EMPTY;
    }
    ConfigDataResourceNotFoundException.throwIfDoesNotExist(resource, resource.getResource());
    StandardConfigDataReference reference = resource.getReference();
    Resource originTrackedResource = OriginTrackedResource.of(resource.getResource(), Origin.from(reference.getConfigDataLocation()));
    String name = String.format("Config resource '%s' via location '%s'", resource, reference.getConfigDataLocation());
    List<PropertySource<?>> propertySources = reference.getPropertySourceLoader().load(name, originTrackedResource);
    PropertySourceOptions options = (resource.getProfile() != null) ? PROFILE_SPECIFIC : NON_PROFILE_SPECIFIC;
    return new ConfigData(propertySources, options);
}
Also used : OriginTrackedResource(org.springframework.boot.origin.OriginTrackedResource) Resource(org.springframework.core.io.Resource) PropertySourceOptions(org.springframework.boot.context.config.ConfigData.PropertySourceOptions) PropertySource(org.springframework.core.env.PropertySource)

Aggregations

PropertySourceOptions (org.springframework.boot.context.config.ConfigData.PropertySourceOptions)1 OriginTrackedResource (org.springframework.boot.origin.OriginTrackedResource)1 PropertySource (org.springframework.core.env.PropertySource)1 Resource (org.springframework.core.io.Resource)1