Polishing

This commit is contained in:
Sam Brannen 2023-08-16 11:44:55 +02:00
parent d81ddcef34
commit 02d3269dbb
3 changed files with 6 additions and 4 deletions

View File

@ -137,8 +137,8 @@ public class PropertySourceProcessor {
propertySources.addLast(propertySource);
}
else {
String firstProcessed = this.propertySourceNames.get(this.propertySourceNames.size() - 1);
propertySources.addBefore(firstProcessed, propertySource);
String lastAdded = this.propertySourceNames.get(this.propertySourceNames.size() - 1);
propertySources.addBefore(lastAdded, propertySource);
}
this.propertySourceNames.add(name);
}

View File

@ -126,6 +126,9 @@ class TestPropertySourceAttributes {
TestContextResourceUtils.convertToClasspathResourcePaths(declaringClass, true, locations);
Class<? extends PropertySourceFactory> factoryClass =
(Class<? extends PropertySourceFactory>) mergedAnnotation.getClass("factory");
if (factoryClass == PropertySourceFactory.class) {
factoryClass = null; // default factory type will be inferred
}
String encoding = mergedAnnotation.getString("encoding");
if (encoding.isBlank()) {
encoding = null; // default encoding will be inferred

View File

@ -293,8 +293,7 @@ public abstract class TestPropertySourceUtils {
for (PropertySourceDescriptor descriptor : descriptors) {
if (!descriptor.locations().isEmpty()) {
Class<? extends PropertySourceFactory> factoryClass = descriptor.propertySourceFactory();
PropertySourceFactory factory =
(factoryClass != null && factoryClass != PropertySourceFactory.class ?
PropertySourceFactory factory = (factoryClass != null ?
BeanUtils.instantiateClass(factoryClass) : defaultPropertySourceFactory);
for (String location : descriptor.locations()) {