Skip to content

Commit 6c46519

Browse files
committed
Merge branch '6.2.x'
2 parents d8b506e + 0867dfc commit 6c46519

File tree

3 files changed

+34
-9
lines changed

3 files changed

+34
-9
lines changed

spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 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.
@@ -50,7 +50,7 @@
5050
* XSD documentation for complete details.
5151
*
5252
* <p>Any local properties (for example, those added via {@link #setProperties}, {@link #setLocations}
53-
* et al.) are added as a {@code PropertySource}. Search precedence of local properties is
53+
* et al.) are added as a single {@link PropertySource}. Search precedence of local properties is
5454
* based on the value of the {@link #setLocalOverride localOverride} property, which is by
5555
* default {@code false} meaning that local properties are to be searched last, after all
5656
* environment property sources.
@@ -99,8 +99,9 @@ public void setPropertySources(PropertySources propertySources) {
9999
}
100100

101101
/**
102-
* {@code PropertySources} from the given {@link Environment}
103-
* will be searched when replacing ${...} placeholders.
102+
* {@inheritDoc}
103+
* <p>{@code PropertySources} from the given {@link Environment} will be searched
104+
* when replacing ${...} placeholders.
104105
* @see #setPropertySources
105106
* @see #postProcessBeanFactory
106107
*/
@@ -173,6 +174,7 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
173174

174175
/**
175176
* Create a {@link ConfigurablePropertyResolver} for the specified property sources.
177+
* <p>The default implementation creates a {@link PropertySourcesPropertyResolver}.
176178
* @param propertySources the property sources to use
177179
* @since 6.0.12
178180
*/
@@ -185,7 +187,7 @@ protected ConfigurablePropertyResolver createPropertyResolver(MutablePropertySou
185187
* placeholders with values from the given properties.
186188
*/
187189
protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess,
188-
final ConfigurablePropertyResolver propertyResolver) throws BeansException {
190+
ConfigurablePropertyResolver propertyResolver) throws BeansException {
189191

190192
propertyResolver.setPlaceholderPrefix(this.placeholderPrefix);
191193
propertyResolver.setPlaceholderSuffix(this.placeholderSuffix);

spring-core/src/main/java/org/springframework/core/env/CompositePropertySource.java

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 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.
@@ -40,6 +40,7 @@
4040
* @author Chris Beams
4141
* @author Juergen Hoeller
4242
* @author Phillip Webb
43+
* @author Sam Brannen
4344
* @since 3.1.1
4445
*/
4546
public class CompositePropertySource extends EnumerablePropertySource<Object> {
@@ -48,13 +49,35 @@ public class CompositePropertySource extends EnumerablePropertySource<Object> {
4849

4950

5051
/**
51-
* Create a new {@code CompositePropertySource}.
52-
* @param name the name of the property source
52+
* Create a new empty {@code CompositePropertySource} with the given name.
53+
* @param name the name of the composite property source
54+
* @see #CompositePropertySource(String, Iterable)
55+
* @see #addPropertySource(PropertySource)
56+
* @see #addFirstPropertySource(PropertySource)
5357
*/
5458
public CompositePropertySource(String name) {
5559
super(name);
5660
}
5761

62+
/**
63+
* Create a new {@code CompositePropertySource} with the given name and
64+
* property sources supplied as an {@link Iterable} or {@link PropertySources}
65+
* implementation, preserving the original order of the property sources.
66+
* @param name the name of the composite property source
67+
* @param propertySources the initial set of {@link PropertySource} instances
68+
* @since 6.2.7
69+
* @see PropertySources
70+
* @see MutablePropertySources
71+
* @see #addPropertySource(PropertySource)
72+
* @see #addFirstPropertySource(PropertySource)
73+
*/
74+
public CompositePropertySource(String name, Iterable<PropertySource<?>> propertySources) {
75+
this(name);
76+
for (PropertySource<?> propertySource : propertySources) {
77+
this.propertySources.add(propertySource);
78+
}
79+
}
80+
5881

5982
@Override
6083
public @Nullable Object getProperty(String name) {

spring-core/src/test/java/org/springframework/core/env/PropertySourcesPropertyResolverTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class PropertySourcesPropertyResolverTests {
4242

4343
private MutablePropertySources propertySources;
4444

45-
private ConfigurablePropertyResolver propertyResolver;
45+
private PropertySourcesPropertyResolver propertyResolver;
4646

4747

4848
@BeforeEach

0 commit comments

Comments
 (0)