List of usage examples for org.springframework.beans.factory.support PropertiesBeanDefinitionReader registerBeanDefinitions
public int registerBeanDefinitions(Map<?, ?> map) throws BeansException
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. */// w w w. j av a 2 s . co m 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; }