Skip to content

Commit abd0676

Browse files
committed
Avoid dependence on deprecated ContextLoader API within AbstractContextLoader
See gh-28905
1 parent cf1d463 commit abd0676

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
7575
// SmartContextLoader
7676

7777
/**
78-
* For backwards compatibility with the {@link ContextLoader} SPI, the
79-
* default implementation simply delegates to {@link #processLocations(Class, String...)},
80-
* passing it the {@link ContextConfigurationAttributes#getDeclaringClass()
81-
* declaring class} and {@link ContextConfigurationAttributes#getLocations()
78+
* The default implementation processes locations analogous to
79+
* {@link #processLocations(Class, String...)}, using the
80+
* {@link ContextConfigurationAttributes#getDeclaringClass() declaring class}
81+
* as the test class and the {@link ContextConfigurationAttributes#getLocations()
8282
* resource locations} retrieved from the supplied
83-
* {@link ContextConfigurationAttributes configuration attributes}. The
84-
* processed locations are then
83+
* {@link ContextConfigurationAttributes configuration attributes} as the
84+
* locations to process. The processed locations are then
8585
* {@link ContextConfigurationAttributes#setLocations(String[]) set} in
8686
* the supplied configuration attributes.
8787
* <p>Can be overridden in subclasses &mdash; for example, to process
@@ -92,7 +92,7 @@ public abstract class AbstractContextLoader implements SmartContextLoader {
9292
@Override
9393
public void processContextConfiguration(ContextConfigurationAttributes configAttributes) {
9494
String[] processedLocations =
95-
processLocations(configAttributes.getDeclaringClass(), configAttributes.getLocations());
95+
processLocationsInternal(configAttributes.getDeclaringClass(), configAttributes.getLocations());
9696
configAttributes.setLocations(processedLocations);
9797
}
9898

@@ -214,6 +214,10 @@ protected void customizeContext(ConfigurableApplicationContext context, MergedCo
214214
@Override
215215
@SuppressWarnings("deprecation")
216216
public final String[] processLocations(Class<?> clazz, String... locations) {
217+
return processLocationsInternal(clazz, locations);
218+
}
219+
220+
private String[] processLocationsInternal(Class<?> clazz, String... locations) {
217221
return (ObjectUtils.isEmpty(locations) && isGenerateDefaultLocations()) ?
218222
generateDefaultLocations(clazz) : modifyLocations(clazz, locations);
219223
}

0 commit comments

Comments
 (0)