Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.XmlBeanDefinitionReader


  private void loadChild(BeansetModuleDefinition definition) {
    parent = new ClassPathXmlApplicationContext("parentTestContext.xml");
    BeansetApplicationModuleLoader moduleLoader = new BeansetApplicationModuleLoader();
    ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
    child = moduleLoader.newApplicationContext(null, parent, definition, classLoader);
    XmlBeanDefinitionReader xmlReader = moduleLoader.newBeanDefinitionReader("id", child, definition);
    xmlReader.setBeanClassLoader(classLoader);
    xmlReader.loadBeanDefinitions(moduleLoader.getSpringConfigResources("id", definition, classLoader));
    child.refresh();
  }
View Full Code Here


    // create the application context, and set the class loader
    GenericApplicationContext context = new GenericApplicationContext(beanFactory);
    context.setClassLoader(classLoader);

    // create the bean definition reader
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
    xmlReader.loadBeanDefinitions(new ClassPathResource("dynamic/dynamic-context.xml", classLoader));

    // refresh the application context - now we're ready to go
    context.refresh();

    assertNotNull(context.getBean("communicationMethod"));
View Full Code Here

        return resourceLoaders;
    }
   
    public XmlBeanDefinitionReader newBeanDefinitionReader(String applicationId, ConfigurableApplicationContext context, ModuleDefinition definition) {
        final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        return new XmlBeanDefinitionReader(ModuleUtils.castToBeanDefinitionRegistry(beanFactory));
    }
View Full Code Here

    return ResourceUtils.toArray(locations);
  }

  public XmlBeanDefinitionReader newBeanDefinitionReader(ConfigurableApplicationContext context, ModuleDefinition definition) {
    final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
    return new XmlBeanDefinitionReader(ModuleUtils.castToBeanDefinitionRegistry(beanFactory));
  }
View Full Code Here

    final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
    applicationContext.setServletContext(servletContext);

    XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
    for (int i = 0; i < locations.length; i++) {
      definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
    }
    applicationContext.refresh();

    return ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"), ModuleManagementFacade.class);
  }
View Full Code Here

public class ExpandableTest extends TestCase {

  public void test() throws InterruptedException {
    GenericApplicationContext context = new GenericApplicationContext();

    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
    xmlReader.loadBeanDefinitions(new ClassPathResource("expandable/core-context.xml"));

    context.refresh();

    RootModuleContextMonitor monitor = new RootModuleContextMonitor(xmlReader, new ClassPathResource(
        "expandable/spring-locations.txt"), new ScheduledThreadPoolExecutor(1));
View Full Code Here

        return resourceLoaders;
    }
   
    public XmlBeanDefinitionReader newBeanDefinitionReader(String applicationId, ConfigurableApplicationContext context, ModuleDefinition definition) {
        final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
        return new XmlBeanDefinitionReader(ModuleUtils.castToBeanDefinitionRegistry(beanFactory));
    }
View Full Code Here

        final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
        applicationContext.setServletContext(servletContext);
        applicationContext.setParent(parent);

        XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
        for (int i = 0; i < locations.length; i++) {
            definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
        }
        applicationContext.refresh();

        return ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"), ModuleManagementFacade.class);
    }
View Full Code Here

    public void testServlet() throws Exception {
       
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.setServletContext(new AttributeServletContext());
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/servletbeancontext.xml"));
       
        context.refresh();
       
        assertEquals("injectedValue", MyServlet1.getMyAttribute());
        assertEquals("initValue", MyServlet2.getConfigParam());
View Full Code Here

        final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
        applicationContext.setServletContext(servletContext);
        applicationContext.setParent(parent);

        XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
        for (int i = 0; i < locations.length; i++) {
            definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
        }
        applicationContext.refresh();

        return ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"), ModuleManagementFacade.class);
    }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.XmlBeanDefinitionReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.