Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.ConfigurableBeanFactory


public class SpringVarProducer implements VarProducer, ApplicationContextAware {

  private ConfigurableApplicationContext applicationContext;
 
  public void fill(GroovyObject groovyScript) {
    ConfigurableBeanFactory beanFactory = applicationContext.getBeanFactory();
    groovyScript.setProperty("applicationContext", applicationContext);
    String[] beanNames = applicationContext.getBeanDefinitionNames();
    for (String beanName : beanNames) {
      BeanDefinition beanDef = beanFactory.getMergedBeanDefinition(beanName);
      if (beanDef.isSingleton()) {
        Object bean = applicationContext.getBean(beanName);
        groovyScript.setProperty(beanName, bean);
      }
    }
View Full Code Here


      registerService();
  }

  private void addBeanFactoryDependency() {
    if (beanFactory instanceof ConfigurableBeanFactory) {
      ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) beanFactory;
      if (StringUtils.hasText(beanName) && cbf.containsBean(beanName)) {
        // no need to validate targetBeanName (already did)
        cbf.registerDependentBean(targetBeanName, BeanFactory.FACTORY_BEAN_PREFIX + beanName);
        cbf.registerDependentBean(targetBeanName, beanName);
      }
    }
    else {
      log.warn("The running bean factory cannot support dependencies between beans - importer/exporter dependency cannot be enforced");
    }
View Full Code Here

  }


  private ConfigurableBeanFactory createMockBF(Object target) {
    MockControl ctrl = MockControl.createNiceControl(ConfigurableBeanFactory.class);
    ConfigurableBeanFactory cbf = (ConfigurableBeanFactory) ctrl.getMock();

    ctrl.expectAndReturn(cbf.getBean(BEAN_NAME), target);
    ctrl.expectAndReturn(cbf.getType(BEAN_NAME), target.getClass());

    ctrl.replay();
    return cbf;
  }
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.ConfigurableBeanFactory

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.