当前位置: 首页>>代码示例>>Java>>正文


Java DefaultListableBeanFactory.setBeanClassLoader方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.support.DefaultListableBeanFactory.setBeanClassLoader方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultListableBeanFactory.setBeanClassLoader方法的具体用法?Java DefaultListableBeanFactory.setBeanClassLoader怎么用?Java DefaultListableBeanFactory.setBeanClassLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.support.DefaultListableBeanFactory的用法示例。


在下文中一共展示了DefaultListableBeanFactory.setBeanClassLoader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEmbeddedBeanFactory

import org.springframework.beans.factory.support.DefaultListableBeanFactory; //导入方法依赖的package包/类
private void createEmbeddedBeanFactory() {
	synchronized (monitor) {
		DefaultListableBeanFactory bf = new DefaultListableBeanFactory(owningBeanFactory);
		if (owningBeanFactory instanceof ConfigurableBeanFactory) {
			bf.copyConfigurationFrom((ConfigurableBeanFactory) owningBeanFactory);
		}
		// just to be on the safe side
		bf.setBeanClassLoader(classLoader);
		// add autowiring processor
		bf.addBeanPostProcessor(new InitialInjectionProcessor());

		beanFactory = bf;
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:ManagedServiceFactoryFactoryBean.java

示例2: SQLErrorCodesFactory

import org.springframework.beans.factory.support.DefaultListableBeanFactory; //导入方法依赖的package包/类
/**
 * Create a new instance of the {@link SQLErrorCodesFactory} class.
 * <p>Not public to enforce Singleton design pattern. Would be private
 * except to allow testing via overriding the
 * {@link #loadResource(String)} method.
 * <p><b>Do not subclass in application code.</b>
 * @see #loadResource(String)
 */
protected SQLErrorCodesFactory() {
	Map<String, SQLErrorCodes> errorCodes;

	try {
		DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
		lbf.setBeanClassLoader(getClass().getClassLoader());
		XmlBeanDefinitionReader bdr = new XmlBeanDefinitionReader(lbf);

		// Load default SQL error codes.
		Resource resource = loadResource(SQL_ERROR_CODE_DEFAULT_PATH);
		if (resource != null && resource.exists()) {
			bdr.loadBeanDefinitions(resource);
		}
		else {
			logger.warn("Default sql-error-codes.xml not found (should be included in spring.jar)");
		}

		// Load custom SQL error codes, overriding defaults.
		resource = loadResource(SQL_ERROR_CODE_OVERRIDE_PATH);
		if (resource != null && resource.exists()) {
			bdr.loadBeanDefinitions(resource);
			logger.info("Found custom sql-error-codes.xml file at the root of the classpath");
		}

		// Check all beans of type SQLErrorCodes.
		errorCodes = lbf.getBeansOfType(SQLErrorCodes.class, true, false);
		if (logger.isInfoEnabled()) {
			logger.info("SQLErrorCodes loaded: " + errorCodes.keySet());
		}
	}
	catch (BeansException ex) {
		logger.warn("Error loading SQL error codes from config file", ex);
		errorCodes = Collections.emptyMap();
	}

	this.errorCodesMap = errorCodes;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:SQLErrorCodesFactory.java


注:本文中的org.springframework.beans.factory.support.DefaultListableBeanFactory.setBeanClassLoader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。