Example usage for org.springframework.beans.factory.config ConfigurableListableBeanFactory containsBeanDefinition

List of usage examples for org.springframework.beans.factory.config ConfigurableListableBeanFactory containsBeanDefinition

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config ConfigurableListableBeanFactory containsBeanDefinition.

Prototype

boolean containsBeanDefinition(String beanName);

Source Link

Document

Check if this bean factory contains a bean definition with the given name.

Usage

From source file:org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.MandatoryImporterDependencyFactory.java

private boolean isLazy(ConfigurableListableBeanFactory beanFactory, String beanName) {
    String name = (beanName.startsWith(BeanFactory.FACTORY_BEAN_PREFIX) ? beanName.substring(1) : beanName);
    if (beanFactory.containsBeanDefinition(name)) {
        return beanFactory.getBeanDefinition(name).isLazyInit();
    }/*from ww w . j a  v  a 2  s .co m*/
    return false;
}

From source file:org.kuali.rice.krad.datadictionary.uif.UifBeanFactoryPostProcessor.java

/**
 * Retrieves the expression graph map set on the bean with given name. If the bean has not been processed
 * by the bean factory post processor, that is done before retrieving the map
 *
 * @param parentBeanName name of the parent bean to retrieve map for (if empty a new map will be returned)
 * @param beanFactory bean factory to retrieve bean definition from
 * @param processedBeanNames set of bean names that have been processed so far
 * @return expression graph map from parent or new instance
 *///  www . ja v  a  2  s.  c om
protected Map<String, String> getExpressionGraphFromParent(String parentBeanName,
        ConfigurableListableBeanFactory beanFactory, Set<String> processedBeanNames) {
    Map<String, String> expressionGraph = new HashMap<String, String>();
    if (StringUtils.isBlank(parentBeanName) || !beanFactory.containsBeanDefinition(parentBeanName)) {
        return expressionGraph;
    }

    BeanDefinition beanDefinition = beanFactory.getBeanDefinition(parentBeanName);
    if (!processedBeanNames.contains(parentBeanName)) {
        processBeanDefinition(parentBeanName, beanDefinition, beanFactory, processedBeanNames);
    }

    MutablePropertyValues pvs = beanDefinition.getPropertyValues();
    PropertyValue propertyExpressionsPV = pvs.getPropertyValue(UifPropertyPaths.EXPRESSION_GRAPH);
    if (propertyExpressionsPV != null) {
        Object value = propertyExpressionsPV.getValue();
        if ((value != null) && (value instanceof ManagedMap)) {
            expressionGraph.putAll((ManagedMap) value);
        }
    }

    return expressionGraph;
}

From source file:org.springframework.flex.config.HibernateSerializationConfigPostProcessor.java

private BeanDefinition findMessageBrokerFactoryBeanDefinition(ConfigurableListableBeanFactory beanFactory) {
    if (beanFactory.containsBeanDefinition(BeanIds.MESSAGE_BROKER)) {
        return beanFactory.getBeanDefinition(BeanIds.MESSAGE_BROKER);
    } else {//w  w  w.  j a va2  s  .c o  m
        for (String beanDefName : beanFactory.getBeanDefinitionNames()) {
            BeanDefinition beanDef = beanFactory.getBeanDefinition(beanDefName);
            if (beanDef.getBeanClassName().equals(MESSAGE_BROKER_FACTORY_BEAN_CLASS_NAME)) {
                return beanDef;
            }
        }
    }
    return null;
}