Skip to content

Commit 02d3269

Browse files
committed
Polishing
1 parent d81ddce commit 02d3269

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ private void addPropertySource(PropertySource<?> propertySource) {
137137
propertySources.addLast(propertySource);
138138
}
139139
else {
140-
String firstProcessed = this.propertySourceNames.get(this.propertySourceNames.size() - 1);
141-
propertySources.addBefore(firstProcessed, propertySource);
140+
String lastAdded = this.propertySourceNames.get(this.propertySourceNames.size() - 1);
141+
propertySources.addBefore(lastAdded, propertySource);
142142
}
143143
this.propertySourceNames.add(name);
144144
}

spring-test/src/main/java/org/springframework/test/context/support/TestPropertySourceAttributes.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ private void addPropertiesAndLocationsFrom(MergedAnnotation<TestPropertySource>
126126
TestContextResourceUtils.convertToClasspathResourcePaths(declaringClass, true, locations);
127127
Class<? extends PropertySourceFactory> factoryClass =
128128
(Class<? extends PropertySourceFactory>) mergedAnnotation.getClass("factory");
129+
if (factoryClass == PropertySourceFactory.class) {
130+
factoryClass = null; // default factory type will be inferred
131+
}
129132
String encoding = mergedAnnotation.getString("encoding");
130133
if (encoding.isBlank()) {
131134
encoding = null; // default encoding will be inferred

spring-test/src/main/java/org/springframework/test/context/support/TestPropertySourceUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ public static void addPropertySourcesToEnvironment(ConfigurableEnvironment envir
293293
for (PropertySourceDescriptor descriptor : descriptors) {
294294
if (!descriptor.locations().isEmpty()) {
295295
Class<? extends PropertySourceFactory> factoryClass = descriptor.propertySourceFactory();
296-
PropertySourceFactory factory =
297-
(factoryClass != null && factoryClass != PropertySourceFactory.class ?
296+
PropertySourceFactory factory = (factoryClass != null ?
298297
BeanUtils.instantiateClass(factoryClass) : defaultPropertySourceFactory);
299298

300299
for (String location : descriptor.locations()) {

0 commit comments

Comments
 (0)