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(); }
/** * Returns {@code "-context.xml" and "Context.groovy"} in order to * support detection of a default XML config file or Groovy script. */ @Override protected String[] getResourceSuffixes() { return new String[] { super.getResourceSuffix(), "Context.groovy" }; }
public SpringTestContext testConfigLocations(String... configLocations) { GenericXmlWebContextLoader loader = new GenericXmlWebContextLoader(); String[] locations = loader.processLocations(this.test.getClass(), configLocations); return configLocations(locations); }
@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 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(); }
/** * Returns {@code "-context.xml" and "Context.groovy"} in order to * support detection of a default XML config file or Groovy script. */ @Override protected String[] getResourceSuffixes() { return new String[] { super.getResourceSuffix(), "Context.groovy" }; }
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(); }
/** * Returns {@code "-context.xml" and "Context.groovy"} in order to * support detection of a default XML config file or Groovy script. */ @Override protected String[] getResourceSuffixes() { return new String[] { super.getResourceSuffix(), "Context.groovy" }; }