|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2012-2022 the original author or authors. |
|
|
|
* Copyright 2012-2023 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -28,6 +28,7 @@ import java.util.Set; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
import org.apache.commons.logging.Log; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.logging.DeferredLogFactory; |
|
|
|
import org.springframework.boot.logging.DeferredLogFactory; |
|
|
|
|
|
|
|
import org.springframework.core.log.LogMessage; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Imports {@link ConfigData} by {@link ConfigDataLocationResolver resolving} and |
|
|
|
* Imports {@link ConfigData} by {@link ConfigDataLocationResolver resolving} and |
|
|
|
@ -117,16 +118,20 @@ class ConfigDataImporter { |
|
|
|
ConfigDataResolutionResult candidate = candidates.get(i); |
|
|
|
ConfigDataResolutionResult candidate = candidates.get(i); |
|
|
|
ConfigDataLocation location = candidate.getLocation(); |
|
|
|
ConfigDataLocation location = candidate.getLocation(); |
|
|
|
ConfigDataResource resource = candidate.getResource(); |
|
|
|
ConfigDataResource resource = candidate.getResource(); |
|
|
|
|
|
|
|
this.logger.trace(LogMessage.format("Considering resource %s from location %s", resource, location)); |
|
|
|
if (resource.isOptional()) { |
|
|
|
if (resource.isOptional()) { |
|
|
|
this.optionalLocations.add(location); |
|
|
|
this.optionalLocations.add(location); |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.loaded.contains(resource)) { |
|
|
|
if (this.loaded.contains(resource)) { |
|
|
|
|
|
|
|
this.logger |
|
|
|
|
|
|
|
.trace(LogMessage.format("Already loaded resource %s ignoring location %s", resource, location)); |
|
|
|
this.loadedLocations.add(location); |
|
|
|
this.loadedLocations.add(location); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
try { |
|
|
|
try { |
|
|
|
ConfigData loaded = this.loaders.load(loaderContext, resource); |
|
|
|
ConfigData loaded = this.loaders.load(loaderContext, resource); |
|
|
|
if (loaded != null) { |
|
|
|
if (loaded != null) { |
|
|
|
|
|
|
|
this.logger.trace(LogMessage.format("Loaded resource %s from location %s", resource, location)); |
|
|
|
this.loaded.add(resource); |
|
|
|
this.loaded.add(resource); |
|
|
|
this.loadedLocations.add(location); |
|
|
|
this.loadedLocations.add(location); |
|
|
|
result.put(candidate, loaded); |
|
|
|
result.put(candidate, loaded); |
|
|
|
|