Search in sources :

Example 6 with XmlReaderContext

use of org.springframework.beans.factory.xml.XmlReaderContext in project spring-framework by spring-projects.

the class AspectJNamespaceHandlerTests method setUp.

@BeforeEach
public void setUp() throws Exception {
    SourceExtractor sourceExtractor = new PassThroughSourceExtractor();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.registry);
    XmlReaderContext readerContext = new XmlReaderContext(null, null, this.readerEventListener, sourceExtractor, reader, null);
    this.parserContext = new ParserContext(readerContext, null);
}
Also used : PassThroughSourceExtractor(org.springframework.beans.factory.parsing.PassThroughSourceExtractor) XmlBeanDefinitionReader(org.springframework.beans.factory.xml.XmlBeanDefinitionReader) XmlReaderContext(org.springframework.beans.factory.xml.XmlReaderContext) ParserContext(org.springframework.beans.factory.xml.ParserContext) SourceExtractor(org.springframework.beans.factory.parsing.SourceExtractor) PassThroughSourceExtractor(org.springframework.beans.factory.parsing.PassThroughSourceExtractor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with XmlReaderContext

use of org.springframework.beans.factory.xml.XmlReaderContext in project qi4j-sdk by Qi4j.

the class Qi4jBootstrapBeanDefinitionParser method createQi4jApplicationBootstrap.

private Qi4jApplicationBootstrap createQi4jApplicationBootstrap(Element anElement, ParserContext aParserContext) {
    String bootstrapClassString = anElement.getAttribute(CLASS);
    hasText(bootstrapClassString);
    XmlReaderContext readerContext = aParserContext.getReaderContext();
    Class<?> bootstrapClass;
    try {
        bootstrapClass = forName(bootstrapClassString);
    } catch (ClassNotFoundException e) {
        readerContext.error("Qi4j bootstrap class [" + bootstrapClassString + "] is not found.", anElement);
        return null;
    }
    if (!Qi4jApplicationBootstrap.class.isAssignableFrom(bootstrapClass)) {
        readerContext.error(CLASS + "attribute is not an instance of [" + Qi4jApplicationBootstrap.class.getName() + "] class", anElement);
        return null;
    }
    Qi4jApplicationBootstrap bootstrap = null;
    try {
        bootstrap = (Qi4jApplicationBootstrap) instantiateClass(bootstrapClass);
    } catch (BeanInstantiationException e) {
        readerContext.error("Fail to instantiate qi4j bootstrap class [" + bootstrapClassString + "]", anElement, e);
    }
    return bootstrap;
}
Also used : XmlReaderContext(org.springframework.beans.factory.xml.XmlReaderContext) BeanInstantiationException(org.springframework.beans.BeanInstantiationException) Qi4jApplicationBootstrap(org.qi4j.library.spring.bootstrap.Qi4jApplicationBootstrap)

Example 8 with XmlReaderContext

use of org.springframework.beans.factory.xml.XmlReaderContext 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);
}
Also used : EmptyReaderEventListener(org.springframework.beans.factory.parsing.EmptyReaderEventListener) XmlReaderContext(org.springframework.beans.factory.xml.XmlReaderContext) DefaultNamespaceHandlerResolver(org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver) NullSourceExtractor(org.springframework.beans.factory.parsing.NullSourceExtractor) FailFastProblemReporter(org.springframework.beans.factory.parsing.FailFastProblemReporter)

Aggregations

XmlReaderContext (org.springframework.beans.factory.xml.XmlReaderContext)8 BeanComponentDefinition (org.springframework.beans.factory.parsing.BeanComponentDefinition)2 EmptyReaderEventListener (org.springframework.beans.factory.parsing.EmptyReaderEventListener)2 FailFastProblemReporter (org.springframework.beans.factory.parsing.FailFastProblemReporter)2 NullSourceExtractor (org.springframework.beans.factory.parsing.NullSourceExtractor)2 SourceExtractor (org.springframework.beans.factory.parsing.SourceExtractor)2 BeanDefinitionRegistry (org.springframework.beans.factory.support.BeanDefinitionRegistry)2 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)2 BeanDefinitionParserDelegate (org.springframework.beans.factory.xml.BeanDefinitionParserDelegate)2 IOException (java.io.IOException)1 URI (java.net.URI)1 URL (java.net.URL)1 NamespaceHandler (org.apache.aries.blueprint.NamespaceHandler)1 ParserContext (org.apache.aries.blueprint.ParserContext)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Qi4jApplicationBootstrap (org.qi4j.library.spring.bootstrap.Qi4jApplicationBootstrap)1 BeanInstantiationException (org.springframework.beans.BeanInstantiationException)1 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)1 RuntimeBeanReference (org.springframework.beans.factory.config.RuntimeBeanReference)1 CompositeComponentDefinition (org.springframework.beans.factory.parsing.CompositeComponentDefinition)1