本文整理汇总了Java中org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor类的典型用法代码示例。如果您正苦于以下问题:Java InstantiationAwareBeanPostProcessor类的具体用法?Java InstantiationAwareBeanPostProcessor怎么用?Java InstantiationAwareBeanPostProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InstantiationAwareBeanPostProcessor类属于org.springframework.beans.factory.config包,在下文中一共展示了InstantiationAwareBeanPostProcessor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addBeanPostProcessor
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor; //导入依赖的package包/类
@Override
public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
Assert.notNull(beanPostProcessor, "BeanPostProcessor must not be null");
this.beanPostProcessors.remove(beanPostProcessor);
this.beanPostProcessors.add(beanPostProcessor);
if (beanPostProcessor instanceof InstantiationAwareBeanPostProcessor) {
this.hasInstantiationAwareBeanPostProcessors = true;
}
if (beanPostProcessor instanceof DestructionAwareBeanPostProcessor) {
this.hasDestructionAwareBeanPostProcessors = true;
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AbstractBeanFactory.java
示例2: 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
示例3: addBeanPostProcessor
import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor; //导入依赖的package包/类
public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
Assert.notNull(beanPostProcessor, "BeanPostProcessor must not be null");
this.beanPostProcessors.remove(beanPostProcessor);
this.beanPostProcessors.add(beanPostProcessor);
if (beanPostProcessor instanceof InstantiationAwareBeanPostProcessor) {
this.hasInstantiationAwareBeanPostProcessors = true;
}
if (beanPostProcessor instanceof DestructionAwareBeanPostProcessor) {
this.hasDestructionAwareBeanPostProcessors = true;
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:12,代码来源:AbstractBeanFactory.java
注:本文中的org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论