Skip to content

Commit 5413ad3

Browse files
committed
Merge pull request #12732 from dreis2211
* pr/12732: Populate cache in ConfigFileApplicationListener Polish
2 parents 0ec737a + cc66de2 commit 5413ad3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,12 @@ private void load(PropertySourceLoader loader, String location, Profile profile,
539539

540540
private List<Document> loadDocuments(PropertySourceLoader loader, String name,
541541
Resource resource) throws IOException {
542-
loader.load(name, resource);
543542
DocumentsCacheKey cacheKey = new DocumentsCacheKey(loader, resource);
544543
List<Document> documents = this.loadDocumentsCache.get(cacheKey);
545544
if (documents == null) {
546545
List<PropertySource<?>> loaded = loader.load(name, resource);
547546
documents = asDocuments(loaded);
547+
this.loadDocumentsCache.put(cacheKey, documents);
548548
}
549549
return documents;
550550
}

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/PropertySourceLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public interface PropertySourceLoader {
4141
/**
4242
* Load the resource into one or more property sources. Implementations may either
4343
* return a list containing a single source, or in the case of a multi-document format
44-
* such as yaml a source or each document in the resource.
44+
* such as yaml a source for each document in the resource.
4545
* @param name the root name of the property source. If multiple documents are loaded
4646
* an additional suffix should be added to the name for each source loaded.
4747
* @param resource the resource to load

0 commit comments

Comments
 (0)