Examples of autowireBeanProperties()


Examples of org.springframework.beans.factory.config.ConfigurableListableBeanFactory.autowireBeanProperties()

        Collection<Object> refreshableBeans =
            ApplicationContextScanner.findBeansWithAnnotation( moduleContext, Refreshable.class );

        for ( Object singleton : refreshableBeans ) {
          Object bean = AcrossContextUtils.getProxyTarget( singleton );
          beanFactory.autowireBeanProperties( bean, AutowireCapableBeanFactory.AUTOWIRE_NO, false );
        }

        Map<String, Object> postRefreshBeans = ApplicationContextScanner.findSingletonsMatching( moduleContext,
                                                                                                 new AnnotatedMethodFilter(
                                                                                                     PostRefresh.class ) );
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

    BeanFactory parent = BeanFactoryLoader.getBeanFactory("test.bootstrap");
    DefaultListableBeanFactory context = new DefaultListableBeanFactory();
    context.setParentBeanFactory(parent);
    context.registerSingleton("this", this);
    SpringDependencyInjectorTaskTest test = (SpringDependencyInjectorTaskTest) context.getBean("this");
    context.autowireBeanProperties(test, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
    assertNotNull("Null test bean", test);
    assertNotNull("Null properties", test.properties);
  }
 
  /**
 
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

    beanFactory.setParentBeanFactory(parentBeanFactory);
    beanFactory.registerSingleton(taskref, target);

    log("Autowiring reference: " + taskref);

    beanFactory.autowireBeanProperties(target, autowireValue, false);
  }

}
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

  public void testAutowireExistingBeanByName() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, new MutablePropertyValues());
    lbf.registerBeanDefinition("spouse", bd);
    DependenciesBean existingBean = new DependenciesBean();
    lbf.autowireBeanProperties(existingBean, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, true);
    TestBean spouse = (TestBean) lbf.getBean("spouse");
    assertEquals(existingBean.getSpouse(), spouse);
    assertSame(spouse, BeanFactoryUtils.beanOfType(lbf, TestBean.class));
  }
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, new MutablePropertyValues());
    lbf.registerBeanDefinition("spous", bd);
    DependenciesBean existingBean = new DependenciesBean();
    try {
      lbf.autowireBeanProperties(existingBean, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, true);
      fail("Should have thrown UnsatisfiedDependencyException");
    }
    catch (UnsatisfiedDependencyException ex) {
      // expected
    }
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

  public void testAutowireExistingBeanByNameWithNoDependencyCheck() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, new MutablePropertyValues());
    lbf.registerBeanDefinition("spous", bd);
    DependenciesBean existingBean = new DependenciesBean();
    lbf.autowireBeanProperties(existingBean, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
    assertNull(existingBean.getSpouse());
  }

  public void testAutowireExistingBeanByType() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

  public void testAutowireExistingBeanByType() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    RootBeanDefinition bd = new RootBeanDefinition(TestBean.class, new MutablePropertyValues());
    lbf.registerBeanDefinition("test", bd);
    DependenciesBean existingBean = new DependenciesBean();
    lbf.autowireBeanProperties(existingBean, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);
    TestBean test = (TestBean) lbf.getBean("test");
    assertEquals(existingBean.getSpouse(), test);
  }

  public void testAutowireExistingBeanByTypeWithDependencyCheck() {
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

  public void testAutowireExistingBeanByTypeWithDependencyCheck() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    DependenciesBean existingBean = new DependenciesBean();
    try {
      lbf.autowireBeanProperties(existingBean, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, true);
      fail("Should have thrown UnsatisfiedDependencyException");
    }
    catch (UnsatisfiedDependencyException expected) {
    }
  }
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

  }

  public void testAutowireExistingBeanByTypeWithNoDependencyCheck() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    DependenciesBean existingBean = new DependenciesBean();
    lbf.autowireBeanProperties(existingBean, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
    assertNull(existingBean.getSpouse());
  }

  public void testInvalidAutowireMode() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
View Full Code Here

Examples of org.springframework.beans.factory.support.DefaultListableBeanFactory.autowireBeanProperties()

  }

  public void testInvalidAutowireMode() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    try {
      lbf.autowireBeanProperties(new TestBean(), AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false);
      fail("Should have thrown IllegalArgumentException");
    }
    catch (IllegalArgumentException expected) {
    }
  }
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.