Package org.springframework.context.support

Examples of org.springframework.context.support.StaticApplicationContext.registerSingleton()


    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("test", "mytest");
    pvs.addPropertyValue("properties", new Properties(props));
    ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
    ac.refresh();
    TestBean tb = (TestBean) ac.getBean("tb");
    assertEquals("mytest", tb.getTouchy());
  }
View Full Code Here


  public void testPropertyPlaceholderConfigurerWithAutowireByType() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("touchy", "${test}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("target", new RuntimeBeanReference("tb"));
    ac.registerSingleton("tbProxy", ProxyFactoryBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("touchy", "${test}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("target", new RuntimeBeanReference("tb"));
    ac.registerSingleton("tbProxy", ProxyFactoryBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("test", "mytest");
    pvs.addPropertyValue("properties", new Properties(props));
    RootBeanDefinition ppcDef = new RootBeanDefinition(PropertyPlaceholderConfigurer.class, pvs);
View Full Code Here

  public void testPropertyPlaceholderConfigurerWithAliases() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("touchy", "${test}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    ac.registerAlias("tb", "${myAlias}");
    ac.registerAlias("${myTarget}", "alias2");
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("test", "mytest");
View Full Code Here

    Properties props = new Properties();
    props.put("test", "mytest");
    props.put("myAlias", "alias");
    props.put("myTarget", "tb");
    pvs.addPropertyValue("properties", new Properties(props));
    ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
    ac.refresh();
    TestBean tb = (TestBean) ac.getBean("tb");
    assertEquals("mytest", tb.getTouchy());
    tb = (TestBean) ac.getBean("alias");
    assertEquals("mytest", tb.getTouchy());
View Full Code Here

    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "${myName}");
    pvs.addPropertyValue("age", "${myAge}");
    pvs.addPropertyValue("touchy", "${myTouchy}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("myAge", "99");
    pvs.addPropertyValue("properties", props);
    ac.registerSingleton("configurer", PreferencesPlaceholderConfigurer.class, pvs);
View Full Code Here

    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("myAge", "99");
    pvs.addPropertyValue("properties", props);
    ac.registerSingleton("configurer", PreferencesPlaceholderConfigurer.class, pvs);
    Preferences.systemRoot().put("myName", "myNameValue");
    Preferences.systemRoot().put("myTouchy", "myTouchyValue");
    Preferences.userRoot().put("myTouchy", "myOtherTouchyValue");
    ac.refresh();
    TestBean tb = (TestBean) ac.getBean("tb");
View Full Code Here

    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "${myName}");
    pvs.addPropertyValue("age", "${myAge}");
    pvs.addPropertyValue("touchy", "${myTouchy}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("myAge", "99");
    pvs.addPropertyValue("properties", props);
    pvs.addPropertyValue("systemTreePath", "mySystemPath");
View Full Code Here

    Properties props = new Properties();
    props.put("myAge", "99");
    pvs.addPropertyValue("properties", props);
    pvs.addPropertyValue("systemTreePath", "mySystemPath");
    pvs.addPropertyValue("userTreePath", "myUserPath");
    ac.registerSingleton("configurer", PreferencesPlaceholderConfigurer.class, pvs);
    Preferences.systemRoot().node("mySystemPath").put("myName", "myNameValue");
    Preferences.systemRoot().node("mySystemPath").put("myTouchy", "myTouchyValue");
    Preferences.userRoot().node("myUserPath").put("myTouchy", "myOtherTouchyValue");
    ac.refresh();
    TestBean tb = (TestBean) ac.getBean("tb");
View Full Code Here

    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "${mypath/myName}");
    pvs.addPropertyValue("age", "${myAge}");
    pvs.addPropertyValue("touchy", "${myotherpath/myTouchy}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    Properties props = new Properties();
    props.put("myAge", "99");
    pvs.addPropertyValue("properties", props);
    pvs.addPropertyValue("systemTreePath", "mySystemPath");
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.