Skip to content

Commit 2e23cf3

Browse files
committed
Clarify name generation responsibility for PropertySourceFactory impls
Closes gh-24757
1 parent bb1699a commit 2e23cf3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

spring-context/src/main/java/org/springframework/context/annotation/PropertySource.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -170,8 +170,11 @@
170170
public @interface PropertySource {
171171

172172
/**
173-
* Indicate the name of this property source. If omitted, a name will
174-
* be generated based on the description of the underlying resource.
173+
* Indicate the name of this property source. If omitted, the {@link #factory()}
174+
* will generate a name based on the underlying resource (in the case of
175+
* {@link org.springframework.core.io.support.DefaultPropertySourceFactory}:
176+
* derived from the resource description through a corresponding name-less
177+
* {@link org.springframework.core.io.support.ResourcePropertySource} constructor).
175178
* @see org.springframework.core.env.PropertySource#getName()
176179
* @see org.springframework.core.io.Resource#getDescription()
177180
*/

spring-core/src/main/java/org/springframework/core/io/support/PropertySourceFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2020 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,6 +33,8 @@ public interface PropertySourceFactory {
3333
/**
3434
* Create a {@link PropertySource} that wraps the given resource.
3535
* @param name the name of the property source
36+
* (can be {@code null} in which case the factory implementation
37+
* will have to generate a name based on the given resource)
3638
* @param resource the resource (potentially encoded) to wrap
3739
* @return the new {@link PropertySource} (never {@code null})
3840
* @throws IOException if resource resolution failed

0 commit comments

Comments
 (0)