use of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver in project spring-framework by spring-projects.
the class DefaultNamespaceHandlerResolverTests method testResolvedMappedHandlerWithNoArgCtor.
@Test
public void testResolvedMappedHandlerWithNoArgCtor() {
DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver();
NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
assertThat(handler).as("Handler should not be null.").isNotNull();
assertThat(handler.getClass()).as("Incorrect handler loaded").isEqualTo(UtilNamespaceHandler.class);
}
use of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver in project spring-framework by spring-projects.
the class DefaultNamespaceHandlerResolverTests method testResolvedMappedHandler.
@Test
public void testResolvedMappedHandler() {
DefaultNamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(getClass().getClassLoader());
NamespaceHandler handler = resolver.resolve("http://www.springframework.org/schema/util");
assertThat(handler).as("Handler should not be null.").isNotNull();
assertThat(handler.getClass()).as("Incorrect handler loaded").isEqualTo(UtilNamespaceHandler.class);
}
use of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver in project spring-framework by spring-projects.
the class TestNamespaceHandler method setUp.
@BeforeEach
public void setUp() throws Exception {
NamespaceHandlerResolver resolver = new DefaultNamespaceHandlerResolver(CLASS.getClassLoader(), NS_PROPS);
this.beanFactory = new GenericApplicationContext();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory);
reader.setNamespaceHandlerResolver(resolver);
reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_XSD);
reader.setEntityResolver(new DummySchemaResolver());
reader.loadBeanDefinitions(getResource());
this.beanFactory.refresh();
}
use of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver in project grails-core by grails.
the class BeanBuilder method initializeBeanBuilderForClassLoader.
protected void initializeBeanBuilderForClassLoader(ClassLoader classLoader) {
xmlBeanDefinitionReader.setBeanClassLoader(classLoader);
namespaceHandlerResolver = new DefaultNamespaceHandlerResolver(this.classLoader);
readerContext = new XmlReaderContext(beanBuildResource, new FailFastProblemReporter(), new EmptyReaderEventListener(), new NullSourceExtractor(), xmlBeanDefinitionReader, namespaceHandlerResolver);
}
use of org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver in project cxf by apache.
the class BusApplicationContext method initBeanDefinitionReader.
@Override
protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
// spring context on the classpath
if (nsHandlerResolver == null) {
nsHandlerResolver = new DefaultNamespaceHandlerResolver();
}
reader.setNamespaceHandlerResolver(nsHandlerResolver);
String mode = getSpringValidationMode();
if (null != mode) {
reader.setValidationModeName(mode);
}
reader.setNamespaceAware(true);
setEntityResolvers(reader);
}
Aggregations