From 49a4ed2ffaa72a4565224d057cc2dca8d57cd0f0 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 1 Apr 2023 15:13:16 +0200 Subject: [PATCH] Improve Javadoc for @PropertySource --- .../context/annotation/PropertySource.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 3d917f6c16..2dc039b940 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 @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -106,7 +106,7 @@ import org.springframework.core.io.support.PropertySourceFactory; * *

A note on property overriding with {@code @PropertySource}

* - *

In cases where a given property key exists in more than one {@code .properties} + *

In cases where a given property key exists in more than one property resource * file, the last {@code @PropertySource} annotation processed will 'win' and override * any previous key with the same name. * @@ -182,14 +182,13 @@ public @interface PropertySource { String name() default ""; /** - * Indicate the resource location(s) of the properties file to be loaded. - *

Both traditional and XML-based properties file formats are supported - * — for example, {@code "classpath:/com/myco/app.properties"} - * or {@code "file:/path/to/file.xml"}. + * Indicate the resource locations of the properties files to be loaded. + *

The default {@link #factory() factory} supports both traditional and + * XML-based properties file formats — for example, + * {@code "classpath:/com/myco/app.properties"} or {@code "file:/path/to/file.xml"}. *

Resource location wildcards (e.g. **/*.properties) are not permitted; - * each location must evaluate to exactly one {@code .properties} or {@code .xml} - * resource. - *

${...} placeholders will be resolved against any/all property sources already + * each location must evaluate to exactly one resource. + *

${...} placeholders will be resolved against property sources already * registered with the {@code Environment}. See {@linkplain PropertySource above} * for examples. *

Each location will be added to the enclosing {@code Environment} as its own @@ -214,7 +213,9 @@ public @interface PropertySource { /** * Specify a custom {@link PropertySourceFactory}, if any. - *

By default, a default factory for standard resource files will be used. + *

By default, a default factory for standard resource files will be used + * which supports {@code *.properties} and {@code *.xml} file formats for + * {@link java.util.Properties}. * @since 4.3 * @see org.springframework.core.io.support.DefaultPropertySourceFactory * @see org.springframework.core.io.support.ResourcePropertySource