From d4e7d192375bbfcdab3f51a28d98db260804018d Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 28 Oct 2012 16:23:49 +0100 Subject: [PATCH] Consistent class loading in ContextLoaderUtils --- .../springframework/test/context/ContextLoaderUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java b/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java index 425878a543..f9c8ef7dba 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextLoaderUtils.java @@ -170,13 +170,13 @@ abstract class ContextLoaderUtils { logger.trace(String.format("Using default ContextLoader class [%s] for test class [%s]", defaultContextLoaderClassName, testClass.getName())); } - return (Class) ContextLoaderUtils.class.getClassLoader().loadClass( - defaultContextLoaderClassName); + return (Class) ClassUtils.forName(defaultContextLoaderClassName, + ContextLoaderUtils.class.getClassLoader()); } - catch (ClassNotFoundException ex) { + catch (Throwable t) { throw new IllegalStateException("Could not load default ContextLoader class [" + defaultContextLoaderClassName + "]. Specify @ContextConfiguration's 'loader' " - + "attribute or make the default loader class available."); + + "attribute or make the default loader class available.", t); } }