|
171 | 171 | public @interface PropertySource {
|
172 | 172 |
|
173 | 173 | /**
|
174 |
| - * Indicate the name of this property source. If omitted, the {@link #factory} |
175 |
| - * will generate a name based on the underlying resource (in the case of |
176 |
| - * {@link org.springframework.core.io.support.DefaultPropertySourceFactory}: |
177 |
| - * derived from the resource description through a corresponding name-less |
178 |
| - * {@link org.springframework.core.io.support.ResourcePropertySource} constructor). |
| 174 | + * Indicate the unique name of this property source. |
| 175 | + * <p>If omitted, the {@link #factory} will generate a name based on the |
| 176 | + * underlying resource (in the case of |
| 177 | + * {@link org.springframework.core.io.support.DefaultPropertySourceFactory |
| 178 | + * DefaultPropertySourceFactory}: derived from the resource description through |
| 179 | + * a corresponding name-less |
| 180 | + * {@link org.springframework.core.io.support.ResourcePropertySource |
| 181 | + * ResourcePropertySource} constructor). |
| 182 | + * <p>The name of a {@code PropertySource} serves two general purposes. |
| 183 | + * <ul> |
| 184 | + * <li>Diagnostics: to determine the source of the properties in logging and |
| 185 | + * debugging — for example, in a Spring Boot application via Spring |
| 186 | + * Boot's {@code PropertySourceOrigin}.</li> |
| 187 | + * <li>Programmatic interaction with |
| 188 | + * {@link org.springframework.core.env.MutablePropertySources MutablePropertySources}: |
| 189 | + * the name can be used to retrieve properties from a particular property |
| 190 | + * source (or to determine if a particular named property source already exists). |
| 191 | + * The name can also be used to add a new property source relative to an existing |
| 192 | + * property source (see |
| 193 | + * {@link org.springframework.core.env.MutablePropertySources#addBefore addBefore()} and |
| 194 | + * {@link org.springframework.core.env.MutablePropertySources#addAfter addAfter()}).</li> |
| 195 | + * </ul> |
179 | 196 | * @see org.springframework.core.env.PropertySource#getName()
|
180 | 197 | * @see org.springframework.core.io.Resource#getDescription()
|
181 | 198 | */
|
|
0 commit comments