Package org.springframework.context.support

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


    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("location", "${user.dir}/test/${user.dir}");
    ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
      fail("Should have thrown BeanInitializationException");
    }
    catch (BeanInitializationException ex) {
View Full Code Here


  public void testPropertyPlaceholderConfigurerWithUnresolvableSystemPropertiesInLocation() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("location", "${myprop}/test/${myprop}");
    ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("spouse", new RuntimeBeanReference("${ref}"));
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("location", "${myprop}/test/${myprop}");
    ac.registerSingleton("configurer", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
      fail("Should have thrown BeanDefinitionStoreException");
    }
    catch (BeanInitializationException ex) {
View Full Code Here

  public void testPropertyPlaceholderConfigurerWithCircularReference() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("age", "${age}");
    pvs.addPropertyValue("name", "name${var}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "age=99\nvar=${m}var\nm=${var}");
    ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
View Full Code Here

    pvs.addPropertyValue("age", "${age}");
    pvs.addPropertyValue("name", "name${var}");
    ac.registerSingleton("tb", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "age=99\nvar=${m}var\nm=${var}");
    ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
      fail("Should have thrown BeanDefinitionStoreException");
    }
    catch (BeanDefinitionStoreException ex) {
View Full Code Here

  public void testPropertyPlaceholderConfigurerWithMultiLevelCircularReference() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "name${var}");
    ac.registerSingleton("tb1", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "var=${m}var\nm=${var2}\nvar2=${var}");
    ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "name${var}");
    ac.registerSingleton("tb1", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "var=${m}var\nm=${var2}\nvar2=${var}");
    ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
      fail("Should have thrown BeanDefinitionStoreException");
    }
    catch (BeanDefinitionStoreException ex) {
View Full Code Here

  public void testPropertyPlaceholderConfigurerWithNestedCircularReference() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "name${var}");
    ac.registerSingleton("tb1", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "var=${m}var\nm=${var2}\nvar2=${m}");
    ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("name", "name${var}");
    ac.registerSingleton("tb1", TestBean.class, pvs);
    pvs = new MutablePropertyValues();
    pvs.addPropertyValue("properties", "var=${m}var\nm=${var2}\nvar2=${m}");
    ac.registerSingleton("configurer1", PropertyPlaceholderConfigurer.class, pvs);
    try {
      ac.refresh();
      fail("Should have thrown BeanDefinitionStoreException");
    }
    catch (BeanDefinitionStoreException ex) {
View Full Code Here

  public void testPropertyPlaceholderConfigurerWithDefaultProperties() {
    StaticApplicationContext ac = new StaticApplicationContext();
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue("touchy", "${test}");
    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);
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.