public WebDelegatingSmartContextLoader() { if (groovyPresent) { try { Class<?> loaderClass = ClassUtils.forName(GROOVY_XML_WEB_CONTEXT_LOADER_CLASS_NAME, WebDelegatingSmartContextLoader.class.getClassLoader()); this.xmlLoader = (SmartContextLoader) BeanUtils.instantiateClass(loaderClass); } catch (Throwable ex) { throw new IllegalStateException("Failed to enable support for Groovy scripts; " + "could not load class: " + GROOVY_XML_WEB_CONTEXT_LOADER_CLASS_NAME, ex); } } else { this.xmlLoader = new GenericXmlWebContextLoader(); } this.annotationConfigLoader = new AnnotationConfigWebContextLoader(); }
@Test public void configMustNotContainAnnotatedClasses() throws Exception { expectedException.expect(IllegalStateException.class); expectedException.expectMessage(containsString("does not support annotated classes")); GenericXmlWebContextLoader loader = new GenericXmlWebContextLoader(); WebMergedContextConfiguration mergedConfig = new WebMergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, new Class<?>[] { getClass() }, null, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, "resource/path", loader, null, null); loader.loadContext(mergedConfig); }
public SpringTestContext testConfigLocations(String... configLocations) { GenericXmlWebContextLoader loader = new GenericXmlWebContextLoader(); String[] locations = loader.processLocations(this.test.getClass(), configLocations); return configLocations(locations); }
public WebDelegatingSmartContextLoader() { if (groovyPresent) { try { Class<?> loaderClass = ClassUtils.forName(GROOVY_XML_WEB_CONTEXT_LOADER_CLASS_NAME, WebDelegatingSmartContextLoader.class.getClassLoader()); this.xmlLoader = (SmartContextLoader) BeanUtils.instantiateClass(loaderClass); } catch (Throwable ex) { throw new IllegalStateException("Failed to enable support for Groovy scripts; " + "could not load class: " + GROOVY_XML_WEB_CONTEXT_LOADER_CLASS_NAME, ex); } } else { this.xmlLoader = new GenericXmlWebContextLoader(); } this.annotationConfigLoader = new AnnotationConfigWebContextLoader(); }
public WebDelegatingSmartContextLoader() { if (groovyPresent) { try { Class<?> loaderClass = ClassUtils.forName(GROOVY_XML_WEB_CONTEXT_LOADER_CLASS_NAME, WebDelegatingSmartContextLoader.class.getClassLoader()); this.xmlLoader = (SmartContextLoader) BeanUtils.instantiateClass(loaderClass); } catch (Throwable ex) { throw new IllegalStateException("Failed to enable support for Groovy scripts; " + "could not load class: " + GROOVY_XML_WEB_CONTEXT_LOADER_CLASS_NAME, ex); } } else { this.xmlLoader = new GenericXmlWebContextLoader(); } this.annotationConfigLoader = new AnnotationConfigWebContextLoader(); }