Skip to content

Commit d4e7d19

Browse files
committed
Consistent class loading in ContextLoaderUtils
1 parent c79c4c6 commit d4e7d19

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ static Class<? extends ContextLoader> resolveContextLoaderClass(Class<?> testCla
170170
logger.trace(String.format("Using default ContextLoader class [%s] for test class [%s]",
171171
defaultContextLoaderClassName, testClass.getName()));
172172
}
173-
return (Class<? extends ContextLoader>) ContextLoaderUtils.class.getClassLoader().loadClass(
174-
defaultContextLoaderClassName);
173+
return (Class<? extends ContextLoader>) ClassUtils.forName(defaultContextLoaderClassName,
174+
ContextLoaderUtils.class.getClassLoader());
175175
}
176-
catch (ClassNotFoundException ex) {
176+
catch (Throwable t) {
177177
throw new IllegalStateException("Could not load default ContextLoader class ["
178178
+ defaultContextLoaderClassName + "]. Specify @ContextConfiguration's 'loader' "
179-
+ "attribute or make the default loader class available.");
179+
+ "attribute or make the default loader class available.", t);
180180
}
181181
}
182182

0 commit comments

Comments
 (0)