@@ -126,7 +126,7 @@ static Class<? extends ContextLoader> resolveContextLoaderClass(Class<?> clazz,
126126 }
127127
128128 try {
129- ContextConfiguration contextConfiguration = clazz .getAnnotation (ContextConfiguration . class );
129+ ContextConfiguration contextConfiguration = clazz .getAnnotation (annotationType );
130130 if (logger .isTraceEnabled ()) {
131131 logger .trace ("Using default ContextLoader class [" + defaultContextLoaderClassName
132132 + "] for @ContextConfiguration [" + contextConfiguration + "] and class [" + clazz + "]" );
@@ -165,17 +165,17 @@ public static String[] resolveContextLocations(ContextLoader contextLoader, Clas
165165 Assert .notNull (contextLoader , "ContextLoader must not be null" );
166166 Assert .notNull (clazz , "Class must not be null" );
167167
168+ boolean processConfigurationClasses = (contextLoader instanceof ResourceTypeAwareContextLoader )
169+ && ((ResourceTypeAwareContextLoader ) contextLoader ).supportsClassResources ();
170+ LocationsResolver locationsResolver = processConfigurationClasses ? classNameLocationsResolver
171+ : resourcePathLocationsResolver ;
172+
168173 Class <ContextConfiguration > annotationType = ContextConfiguration .class ;
169174 Class <?> declaringClass = AnnotationUtils .findAnnotationDeclaringClass (annotationType , clazz );
170175 Assert .notNull (declaringClass , String .format (
171176 "Could not find an 'annotation declaring class' for annotation type [%s] and class [%s]" , annotationType ,
172177 clazz ));
173178
174- boolean processConfigurationClasses = (contextLoader instanceof ResourceTypeAwareContextLoader )
175- && ((ResourceTypeAwareContextLoader ) contextLoader ).supportsClassResources ();
176- LocationsResolver locationsResolver = processConfigurationClasses ? classNameLocationsResolver
177- : resourcePathLocationsResolver ;
178-
179179 List <String > locationsList = new ArrayList <String >();
180180
181181 while (declaringClass != null ) {
0 commit comments