Skip to content

Commit cbb9419

Browse files
committed
Clarify CompositePropertySource behavior for EnumerablePropertySource contract
Closes gh-34886 (cherry picked from commit 6a94444)
1 parent 5b5e2b6 commit cbb9419

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 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.
@@ -33,7 +33,10 @@
3333
*
3434
* <p>As of Spring 4.1.2, this class extends {@link EnumerablePropertySource} instead
3535
* of plain {@link PropertySource}, exposing {@link #getPropertyNames()} based on the
36-
* accumulated property names from all contained sources (as far as possible).
36+
* accumulated property names from all contained sources - and failing with an
37+
* {@code IllegalStateException} against any non-{@code EnumerablePropertySource}.
38+
* <b>When used through the {@code EnumerablePropertySource} contract, all contained
39+
* sources are expected to be of type {@code EnumerablePropertySource} as well.</b>
3740
*
3841
* @author Chris Beams
3942
* @author Juergen Hoeller

0 commit comments

Comments
 (0)