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


Java InstantiationAwareBeanPostProcessor.postProcessBeforeInstantiation方法代码示例

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


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

示例1: applyBeanPostProcessorsBeforeInstantiation

import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor; //导入方法依赖的package包/类
/**
 * Apply InstantiationAwareBeanPostProcessors to the specified bean definition
 * (by class and name), invoking their {@code postProcessBeforeInstantiation} methods.
 * <p>Any returned object will be used as the bean instead of actually instantiating
 * the target bean. A {@code null} return value from the post-processor will
 * result in the target bean being instantiated.
 * @param beanClass the class of the bean to be instantiated
 * @param beanName the name of the bean
 * @return the bean object to use instead of a default instance of the target bean, or {@code null}
 * @throws BeansException if any post-processing failed
 * @see InstantiationAwareBeanPostProcessor#postProcessBeforeInstantiation
 */
protected Object applyBeanPostProcessorsBeforeInstantiation(Class<?> beanClass, String beanName)
		throws BeansException {

	for (BeanPostProcessor bp : getBeanPostProcessors()) {
		if (bp instanceof InstantiationAwareBeanPostProcessor) {
			InstantiationAwareBeanPostProcessor ibp = (InstantiationAwareBeanPostProcessor) bp;
			Object result = ibp.postProcessBeforeInstantiation(beanClass, beanName);
			if (result != null) {
				return result;
			}
		}
	}
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:AbstractAutowireCapableBeanFactory.java


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