Java Code Examples for org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setNamespaceHandlerResolver()

The following examples show how to use org.springframework.beans.factory.xml.XmlBeanDefinitionReader#setNamespaceHandlerResolver() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BusApplicationContext.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException {
        // Create a new XmlBeanDefinitionReader for the given BeanFactory.
    XmlBeanDefinitionReader beanDefinitionReader =
        new ControlledValidationXmlBeanDefinitionReader(beanFactory);
    beanDefinitionReader.setNamespaceHandlerResolver(nsHandlerResolver);

    // Configure the bean definition reader with this context's
    // resource loading environment.
    beanDefinitionReader.setResourceLoader(this);
    beanDefinitionReader.setEntityResolver(new ResourceEntityResolver(this));

    // Allow a subclass to provide custom initialization of the reader,
    // then proceed with actually loading the bean definitions.
    initBeanDefinitionReader(beanDefinitionReader);
    loadBeanDefinitions(beanDefinitionReader);
}
 
Example 2
Source File: CustomNamespaceHandlerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Before
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();
}
 
Example 3
Source File: CustomNamespaceHandlerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Before
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();
}
 
Example 4
Source File: CustomNamespaceHandlerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Before
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();
}