Example usage for org.springframework.beans.factory.support PropertiesBeanDefinitionReader setDefaultParentBean

List of usage examples for org.springframework.beans.factory.support PropertiesBeanDefinitionReader setDefaultParentBean

Introduction

In this page you can find the example usage for org.springframework.beans.factory.support PropertiesBeanDefinitionReader setDefaultParentBean.

Prototype

public void setDefaultParentBean(@Nullable String defaultParentBean) 

Source Link

Document

Set the default parent bean for this bean factory.

Usage

From source file:org.sakaiproject.metaobj.utils.mvc.impl.beans.AddableResourceBundleViewResolver.java

/**
 * Initialize the BeanFactory from the ResourceBundle, for the given locale.
 * Synchronized because of access by parallel threads.
 *///from   www.  j  a  v  a  2 s. com
protected synchronized BeanFactory initFactory(Locale locale) throws MissingResourceException, BeansException {
    BeanFactory parsedBundle = isCache() ? (BeanFactory) this.cachedFactories.get(locale) : null;
    if (parsedBundle != null) {
        return parsedBundle;
    }

    DefaultListableBeanFactory factory = new DefaultListableBeanFactory(getApplicationContext());
    PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(factory);
    reader.setDefaultParentBean(this.defaultParentView);
    for (Iterator i = baseNames.iterator(); i.hasNext();) {
        ResourceBundle bundle = ResourceBundle.getBundle((String) i.next(), locale,
                Thread.currentThread().getContextClassLoader());
        reader.registerBeanDefinitions(bundle);
    }
    factory.registerCustomEditor(Resource.class, new ResourceEditor(getApplicationContext()));

    if (isCache()) {
        factory.preInstantiateSingletons();
        this.cachedFactories.put(locale, factory);
    }
    return factory;
}