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 configMustNotContainLocations() throws Exception { expectedException.expect(IllegalStateException.class); expectedException.expectMessage(containsString("does not support resource locations")); AnnotationConfigWebContextLoader loader = new AnnotationConfigWebContextLoader(); WebMergedContextConfiguration mergedConfig = new WebMergedContextConfiguration(getClass(), new String[] { "config.xml" }, EMPTY_CLASS_ARRAY, null, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, EMPTY_STRING_ARRAY, "resource/path", loader, null, null); loader.loadContext(mergedConfig); }
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(); }