Package org.springframework.beans.factory.xml

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


      Properties properties = new BeanSetPropertiesReader().readBeanSetDefinition(classLoader, overrides);     
     
      final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
      final RecordingImportingBeanDefinitionDocumentReader documentReader = new RecordingImportingBeanDefinitionDocumentReader(properties);

      XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ModuleUtils.castToBeanDefinitionRegistry(beanFactory)){
        protected BeanDefinitionDocumentReader createBeanDefinitionDocumentReader() {
          return documentReader;
        }
      };
      return xmlReader;
View Full Code Here


    public void test() {
        ProxyCreatingBeanFactory beanFactory = new ProxyCreatingBeanFactory();
        GenericApplicationContext context = new GenericApplicationContext(beanFactory);

        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(context);
        xmlReader.loadBeanDefinitions(new ClassPathResource("missingbean/spring-context.xml"));

        context.refresh();
        ClientBean clientBean = (ClientBean) context.getBean("clientBean");

        System.out.println("\nOutput when client bean uses 'missing' collaborator:");
View Full Code Here

   
    public void testNewBeanDefinitionReader() throws Exception {
       
        BaseSpringModuleLoader loader = new ApplicationModuleLoader();
        GenericApplicationContext context = new GenericApplicationContext();
        XmlBeanDefinitionReader reader = loader.newBeanDefinitionReader("id", context, new SimpleModuleDefinition("pluginName"));
        assertSame(context.getBeanFactory(), reader.getBeanFactory());
    }
View Full Code Here

   * @see #loadBeanDefinitions
   */
  @Override
  protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOException {
    // Create a new XmlBeanDefinitionReader for the given BeanFactory.
    XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory);

    // Configure the bean definition reader with this context's
    // resource loading environment.
    beanDefinitionReader.setEnvironment(this.getEnvironment());
    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);
View Full Code Here

    return classLoaderFactory;
  }

  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

        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

    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

    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

    return resourceLoaders;
  }

  public XmlBeanDefinitionReader newBeanDefinitionReader(ConfigurableApplicationContext context, ModuleDefinition definition) {
    final ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();
    return new XmlBeanDefinitionReader(ModuleUtils.castToBeanDefinitionRegistry(beanFactory));
  }
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.