Package org.springframework.beans.factory.xml

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


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

      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 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/jspservletbeancontext.xml"));
       
        context.refresh();
       
        final Object factoryBean = context.getBean("&jspServlet");
        assertTrue(factoryBean instanceof JspServletFactoryBean);
View Full Code Here

    public void testParser() {
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.setServletContext(new AttributeServletContext());
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/listenerbeancontext.xml"));
       
        context.refresh();
       
        TestContextListener listener = (TestContextListener) context.getBean("listener");
        assertTrue(listener.isInitialized());
View Full Code Here

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

    public void testDefault() throws Exception {
       
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.setServletContext(new AttributeServletContext());
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/defaultservletcontext.xml"));
       
        context.refresh();
       
        Map<String,ServletFactoryBean> factoryBeans = context.getBeansOfType(ServletFactoryBean.class);
        assertEquals(1, factoryBeans.size());
View Full Code Here

    public void testDispatcherServlet() throws Exception {
       
        GenericWebApplicationContext context = new GenericWebApplicationContext();
        context.setServletContext(new AttributeServletContext());
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/web/spring/config/dispatcherservletcontext.xml"));
       
        context.refresh();
       
        Map<String,ServletFactoryBean> factoryBeans = context.getBeansOfType(ServletFactoryBean.class);
        assertEquals(1, factoryBeans.size());
View Full Code Here

   * @param factoryKey the bean name of the factory to obtain
   * @return the corresponding BeanFactory reference
   */
  protected BeanFactory createDefinition(String resourceLocation, String factoryKey) {
    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);
    ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();

    try {
      Resource[] configResources = resourcePatternResolver.getResources(resourceLocation);
      if (configResources.length == 0) {
        throw new FatalBeanException("Unable to find resource for specified definition. " +
            "Group resource name [" + this.resourceLocation + "], factory key [" + factoryKey + "]");
      }
      reader.loadBeanDefinitions(configResources);
    }
    catch (IOException ex) {
      throw new BeanDefinitionStoreException(
          "Error accessing bean definition resource [" + this.resourceLocation + "]", ex);
    }
View Full Code Here

   
    public void testDefault() throws Exception {
       
        GenericApplicationContext context = new GenericApplicationContext();
       
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
        reader.loadBeanDefinitions(new ClassPathResource("org/impalaframework/spring/config/dynamicproperties-context.xml"));
       
        context.refresh();
        DynamicPropertiesBean bean = (DynamicPropertiesBean) context.getBean("testBean");
        bean.print();
       
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.