Search in sources :

Example 1 with ParserContext

use of org.springframework.beans.factory.xml.ParserContext in project grails-core by grails.

the class BeanBuilder method createDynamicElementReader.

protected DynamicElementReader createDynamicElementReader(String namespace, final boolean decorator) {
    NamespaceHandler handler = namespaceHandlers.get(namespace);
    ParserContext parserContext = new ParserContext(readerContext, new BeanDefinitionParserDelegate(readerContext));
    final DynamicElementReader dynamicElementReader = new DynamicElementReader(namespace, namespaces, handler, parserContext) {

        @Override
        protected void afterInvocation() {
            if (!decorator) {
                currentBeanConfig = null;
            }
        }
    };
    dynamicElementReader.setClassLoader(classLoader);
    if (currentBeanConfig != null) {
        dynamicElementReader.setBeanConfiguration(currentBeanConfig);
    } else if (!decorator) {
        currentBeanConfig = new DefaultBeanConfiguration(namespace);
        dynamicElementReader.setBeanConfiguration(currentBeanConfig);
    }
    dynamicElementReader.setBeanDecorator(decorator);
    return dynamicElementReader;
}
Also used : DefaultBeanConfiguration(org.grails.spring.DefaultBeanConfiguration) BeanDefinitionParserDelegate(org.springframework.beans.factory.xml.BeanDefinitionParserDelegate) NamespaceHandler(org.springframework.beans.factory.xml.NamespaceHandler) ParserContext(org.springframework.beans.factory.xml.ParserContext)

Example 2 with ParserContext

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

the class AspectJNamespaceHandlerTests method setUp.

@Before
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) Before(org.junit.Before)

Aggregations

ParserContext (org.springframework.beans.factory.xml.ParserContext)2 DefaultBeanConfiguration (org.grails.spring.DefaultBeanConfiguration)1 Before (org.junit.Before)1 PassThroughSourceExtractor (org.springframework.beans.factory.parsing.PassThroughSourceExtractor)1 SourceExtractor (org.springframework.beans.factory.parsing.SourceExtractor)1 BeanDefinitionParserDelegate (org.springframework.beans.factory.xml.BeanDefinitionParserDelegate)1 NamespaceHandler (org.springframework.beans.factory.xml.NamespaceHandler)1 XmlBeanDefinitionReader (org.springframework.beans.factory.xml.XmlBeanDefinitionReader)1 XmlReaderContext (org.springframework.beans.factory.xml.XmlReaderContext)1