Merge pull request #12732 from dreis2211

* pr/12732:
  Populate cache in ConfigFileApplicationListener
  Polish
This commit is contained in:
Phillip Webb 2018-04-04 18:10:33 -07:00
commit 5413ad3ce7
2 changed files with 2 additions and 2 deletions

View File

@ -539,12 +539,12 @@ public class ConfigFileApplicationListener
private List<Document> loadDocuments(PropertySourceLoader loader, String name,
Resource resource) throws IOException {
loader.load(name, resource);
DocumentsCacheKey cacheKey = new DocumentsCacheKey(loader, resource);
List<Document> documents = this.loadDocumentsCache.get(cacheKey);
if (documents == null) {
List<PropertySource<?>> loaded = loader.load(name, resource);
documents = asDocuments(loaded);
this.loadDocumentsCache.put(cacheKey, documents);
}
return documents;
}

View File

@ -41,7 +41,7 @@ public interface PropertySourceLoader {
/**
* Load the resource into one or more property sources. Implementations may either
* return a list containing a single source, or in the case of a multi-document format
* such as yaml a source or each document in the resource.
* such as yaml a source for each document in the resource.
* @param name the root name of the property source. If multiple documents are loaded
* an additional suffix should be added to the name for each source loaded.
* @param resource the resource to load