Package org.springframework.beans.factory.support

Examples of org.springframework.beans.factory.support.BeanDefinitionReader.loadBeanDefinitions()


          throw new IllegalStateException("Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
        }
      }
      BeanDefinitionReader reader = readerInstanceCache.get(readerClass);
      // TODO SPR-6310: qualify relative path locations as done in AbstractContextLoader.modifyLocations
      reader.loadBeanDefinitions(resource);
    }
  }


  /**
 
View Full Code Here


      }
    }

    BeanDefinitionReader beanDefinitionReader = moduleLoader.newBeanDefinitionReader(parentContext,
        newRootDefinition);
    beanDefinitionReader.loadBeanDefinitions(toAddList.toArray(new Resource[toAddList.size()]));

    return true;
  }

  private List<Resource> newResourceList(Resource[] array) {
View Full Code Here

          throw new IllegalStateException("Could not instantiate BeanDefinitionReader class [" + readerClass.getName() + "]");
        }
      }
      BeanDefinitionReader reader = readerInstanceCache.get(readerClass);
      // TODO SPR-6310: qualify relative path locations as done in AbstractContextLoader.modifyLocations
      reader.loadBeanDefinitions(resource);
    }
  }


  /**
 
View Full Code Here

  public void testConfigureExporterParametersWithEncodingFromPropertiesFile() throws Exception {
    GenericWebApplicationContext ac = new GenericWebApplicationContext();
    ac.setServletContext(new MockServletContext());
    BeanDefinitionReader reader = new PropertiesBeanDefinitionReader(ac);
    reader.loadBeanDefinitions(new ClassPathResource("view.properties", getClass()));
    ac.refresh();

    AbstractJasperReportsView view = (AbstractJasperReportsView) ac.getBean("report");
    String encoding = (String) view.getConvertedExporterParameters().get(JRHtmlExporterParameter.CHARACTER_ENCODING);
    assertEquals("UTF-8", encoding);
View Full Code Here


  public void testCustomResolver() {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(bf);
    reader.loadBeanDefinitions(CONFIG_LOCATION);
    CustomAutowireConfigurer cac = new CustomAutowireConfigurer();
    CustomResolver customResolver = new CustomResolver();
    bf.setAutowireCandidateResolver(customResolver);
    cac.postProcessBeanFactory(bf);
    TestBean testBean = (TestBean) bf.getBean("testBean");
View Full Code Here


  public void testNonQualifiedFieldFails() {
    StaticApplicationContext context = new StaticApplicationContext();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
    reader.loadBeanDefinitions(CONFIG_LOCATION);
    context.registerSingleton("testBean", NonQualifiedTestBean.class);
    try {
      context.refresh();
      fail("Should have thrown a BeanCreationException");
    }
View Full Code Here

  }

  public void testQualifiedByValue() {
    StaticApplicationContext context = new StaticApplicationContext();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
    reader.loadBeanDefinitions(CONFIG_LOCATION);
    context.registerSingleton("testBean", QualifiedByValueTestBean.class);
    context.refresh();
    QualifiedByValueTestBean testBean = (QualifiedByValueTestBean) context.getBean("testBean");
    Person person = testBean.getLarry();
    assertEquals("Larry", person.getName());
View Full Code Here

  }

  public void testQualifiedByBeanName() {
    StaticApplicationContext context = new StaticApplicationContext();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
    reader.loadBeanDefinitions(CONFIG_LOCATION);
    context.registerSingleton("testBean", QualifiedByBeanNameTestBean.class);
    context.refresh();
    QualifiedByBeanNameTestBean testBean = (QualifiedByBeanNameTestBean) context.getBean("testBean");
    Person person = testBean.getLarry();
    assertEquals("LarryBean", person.getName());
View Full Code Here

  }

  public void testQualifiedByAlias() {
    StaticApplicationContext context = new StaticApplicationContext();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
    reader.loadBeanDefinitions(CONFIG_LOCATION);
    context.registerSingleton("testBean", QualifiedByAliasTestBean.class);
    context.refresh();
    QualifiedByAliasTestBean testBean = (QualifiedByAliasTestBean) context.getBean("testBean");
    Person person = testBean.getStooge();
    assertEquals("LarryBean", person.getName());   
View Full Code Here

  }

  public void testQualifiedByAnnotation() {
    StaticApplicationContext context = new StaticApplicationContext();
    BeanDefinitionReader reader = new XmlBeanDefinitionReader(context);
    reader.loadBeanDefinitions(CONFIG_LOCATION);
    context.registerSingleton("testBean", QualifiedByAnnotationTestBean.class);
    context.refresh();
    QualifiedByAnnotationTestBean testBean = (QualifiedByAnnotationTestBean) context.getBean("testBean");
    Person person = testBean.getLarry();
    assertEquals("LarrySpecial", person.getName());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.