Package org.springframework.beans.factory.support

Examples of org.springframework.beans.factory.support.PropertiesBeanDefinitionReader


    sac.registerSingleton("aca", ACATest.class, new MutablePropertyValues());

    sac.registerPrototype("aca-prototype", ACATest.class, new MutablePropertyValues());

    PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
    reader.loadBeanDefinitions(new ClassPathResource("testBeans.properties", getClass()));
    sac.refresh();
    sac.addListener(listener);

    StaticMessageSource messageSource = sac.getStaticMessageSource();
    Map usMessages = new HashMap(3);
View Full Code Here


    this.sac = new StaticApplicationContext(parent);
    sac.registerSingleton("beanThatListens", BeanThatListens.class, new MutablePropertyValues());
    sac.registerSingleton("aca", ACATest.class, new MutablePropertyValues());
    sac.registerPrototype("aca-prototype", ACATest.class, new MutablePropertyValues());
    PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
    Resource resource = new ClassPathResource("testBeans.properties", getClass());
    reader.loadBeanDefinitions(new EncodedResource(resource, "ISO-8859-1"));
    sac.refresh();
    sac.addListener(listener);

    sac.getStaticMessageSource().addMessage("code2", Locale.getDefault(), "message2");
View Full Code Here

   * Creates a new {@link PropertiesBeanDefinitionReader}.
   *
   * @see org.springframework.test.AbstractSingleSpringContextTests#createBeanDefinitionReader(org.springframework.context.support.GenericApplicationContext)
   */
  protected final BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
    return new PropertiesBeanDefinitionReader(context);
  }
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

    KnowsIfInstantiated.clearInstantiationRecord();
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    Properties p = new Properties();
    p.setProperty("x1.(class)", KnowsIfInstantiated.class.getName());
    assertTrue("singleton not instantiated", !KnowsIfInstantiated.wasInstantiated());
    (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
    lbf.preInstantiateSingletons();
    assertTrue("singleton was instantiated", KnowsIfInstantiated.wasInstantiated());
  }
View Full Code Here

    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    Properties p = new Properties();
    p.setProperty("x1.(class)", KnowsIfInstantiated.class.getName());
    p.setProperty("x1.(lazy-init)", "true");
    assertTrue("singleton not instantiated", !KnowsIfInstantiated.wasInstantiated());
    (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
    assertTrue("singleton not instantiated", !KnowsIfInstantiated.wasInstantiated());
    lbf.preInstantiateSingletons();

    assertTrue("singleton not instantiated", !KnowsIfInstantiated.wasInstantiated());
    lbf.getBean("x1");
View Full Code Here

    p.setProperty("x1.(class)", DummyFactory.class.getName());
    // Reset static state
    DummyFactory.reset();
    p.setProperty("x1.singleton", "false");
    assertTrue("prototype not instantiated", !DummyFactory.wasPrototypeCreated());
    (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);
    assertTrue("prototype not instantiated", !DummyFactory.wasPrototypeCreated());
    assertEquals(TestBean.class, lbf.getType("x1"));
    lbf.preInstantiateSingletons();

    assertTrue("prototype not instantiated", !DummyFactory.wasPrototypeCreated());
View Full Code Here

    p.setProperty("x1.(class)", DummyFactory.class.getName());
    // Reset static state
    DummyFactory.reset();
    p.setProperty("x1.(singleton)", "false");
    p.setProperty("x1.singleton", "false");
    (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);

    assertTrue("prototype not instantiated", !DummyFactory.wasPrototypeCreated());
    String[] beanNames = lbf.getBeanNamesForType(TestBean.class, true, false);
    assertEquals(0, beanNames.length);
    beanNames = lbf.getBeanNamesForAnnotation(SuppressWarnings.class);
View Full Code Here

    p.setProperty("x1.(class)", DummyFactory.class.getName());
    // Reset static state
    DummyFactory.reset();
    p.setProperty("x1.(singleton)", "false");
    p.setProperty("x1.singleton", "true");
    (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);

    assertTrue("prototype not instantiated", !DummyFactory.wasPrototypeCreated());
    String[] beanNames = lbf.getBeanNamesForType(TestBean.class, true, false);
    assertEquals(0, beanNames.length);
    beanNames = lbf.getBeanNamesForAnnotation(SuppressWarnings.class);
View Full Code Here

    Properties p = new Properties();
    p.setProperty("x1.(class)", DummyFactory.class.getName());
    // Reset static state
    DummyFactory.reset();
    p.setProperty("x1.singleton", "false");
    (new PropertiesBeanDefinitionReader(lbf)).registerBeanDefinitions(p);

    assertTrue("prototype not instantiated", !DummyFactory.wasPrototypeCreated());
    String[] beanNames = lbf.getBeanNamesForType(TestBean.class, true, false);
    assertEquals(0, beanNames.length);
    beanNames = lbf.getBeanNamesForAnnotation(SuppressWarnings.class);
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.support.PropertiesBeanDefinitionReader

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.