diff --git a/spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java b/spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java index 75d9fc6b8f..d6e5dc4339 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java @@ -169,11 +169,28 @@ import org.springframework.core.io.support.PropertySourceFactory; public @interface PropertySource { /** - * Indicate the name of this property source. If omitted, the {@link #factory} - * will generate a name based on the underlying resource (in the case of - * {@link org.springframework.core.io.support.DefaultPropertySourceFactory}: - * derived from the resource description through a corresponding name-less - * {@link org.springframework.core.io.support.ResourcePropertySource} constructor). + * Indicate the unique name of this property source. + *
If omitted, the {@link #factory} will generate a name based on the + * underlying resource (in the case of + * {@link org.springframework.core.io.support.DefaultPropertySourceFactory + * DefaultPropertySourceFactory}: derived from the resource description through + * a corresponding name-less + * {@link org.springframework.core.io.support.ResourcePropertySource + * ResourcePropertySource} constructor). + *
The name of a {@code PropertySource} serves two general purposes. + *
See the {@linkplain PropertySource class-level Javadoc} for details
+ * on property source identity and names.
*/
public String getName() {
return this.name;
@@ -170,21 +172,22 @@ public abstract class PropertySource Primarily for internal use, but given a collection of {@code PropertySource} objects, may be
- * used as follows:
+ * Return a {@code PropertySource} implementation intended for collection
+ * comparison purposes only.
+ * Primarily for internal use, but given a collection of {@code PropertySource}
+ * objects, may be used as follows:
* The returned {@code PropertySource} will throw {@code UnsupportedOperationException}
* if any methods other than {@code equals(Object)}, {@code hashCode()}, and {@code toString()}
* are called.
- * @param name the name of the comparison {@code PropertySource} to be created and returned.
+ * @param name the name of the comparison {@code PropertySource} to be created
+ * and returned
*/
public static PropertySource> named(String name) {
return new ComparisonPropertySource(name);
@@ -206,7 +209,7 @@ public abstract class PropertySource
- * {@code List
- * The returned {@code PropertySource} will throw {@code UnsupportedOperationException}
+ * assert !sources.contains(PropertySource.named("sourceC"));
+ *