Skip to content

Commit 6a94444

Browse files
committed
Clarify CompositePropertySource behavior for EnumerablePropertySource contract
Closes gh-34886
1 parent 03ae97b commit 6a94444

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-core/src/main/java/org/springframework/core/env/CompositePropertySource.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,10 @@
3434
*
3535
* <p>As of Spring 4.1.2, this class extends {@link EnumerablePropertySource} instead
3636
* of plain {@link PropertySource}, exposing {@link #getPropertyNames()} based on the
37-
* accumulated property names from all contained sources (as far as possible).
37+
* accumulated property names from all contained sources - and failing with an
38+
* {@code IllegalStateException} against any non-{@code EnumerablePropertySource}.
39+
* <b>When used through the {@code EnumerablePropertySource} contract, all contained
40+
* sources are expected to be of type {@code EnumerablePropertySource} as well.</b>
3841
*
3942
* @author Chris Beams
4043
* @author Juergen Hoeller

0 commit comments

Comments
 (0)