当前位置: 首页 > news >正文

12-bean创建流程3

文章目录

    • 1 bean实例化前
  • 2. bean实例化doCreateBean()

1 bean实例化前

createBean方法里面的resolveBeforeInstantiation方法,InstantiationAwareBeanPostProcessor接口创建一个代理对象返回

try {// Give BeanPostProcessors a chance to return a proxy instead of the target bean instance.Object bean = resolveBeforeInstantiation(beanName, mbdToUse);if (bean != null) {return bean;}
}
/*** Apply before-instantiation post-processors, resolving whether there is a* before-instantiation shortcut for the specified bean.* @param beanName the name of the bean* @param mbd the bean definition for the bean* @return the shortcut-determined bean instance, or {@code null} if none*/
@Nullable
protected Object resolveBeforeInstantiation(String beanName, RootBeanDefinition mbd) {Object bean = null;if (!Boolean.FALSE.equals(mbd.beforeInstantiationResolved)) {// Make sure bean class is actually resolved at this point.if (!mbd.isSynthetic() && hasInstantiationAwareBeanPostProcessors()) {Class<?> targetType = determineTargetType(beanName, mbd);if (targetType != null) {bean = applyBeanPostProcessorsBeforeInstantiation(targetType, beanName);if (bean != null) {bean = applyBeanPostProcessorsAfterInitialization(bean, beanName);}}}mbd.beforeInstantiationResolved = (bean != null);}return bean;
}

2. bean实例化doCreateBean()

spring创建bean的方式有哪几种
在这里插入图片描述

http://www.lryc.cn/news/194504.html

相关文章:

  • volatile关键字 和 i = i + 1过程
  • ubuntu20 安装 cmake 3.27
  • faster lio 回环 加入GTSAM优化的记录
  • 深入剖析 深度学习中 __init()__函数和forward()函数
  • BUUCTF学习(一):SQL注入,万能密码
  • 基于springboot实现心灵治愈心理健康平台系统项目【项目源码+论文说明】计算机毕业设计
  • 百度Apollo自动驾驶
  • 数据迁移库工具-C版-01-HappySunshineV1.0-(支持Gbase8a)
  • 【sv】 pack/unpack stream
  • 二、使用DockerCompose部署RocketMQ
  • 论文笔记[156]PARAFAC. tutorial and applications
  • AKKA.Net 的使用 来自CHATGPT
  • 网络安全—小白学习笔记
  • OpenRemote: Java 开源 IoT 物联网开发平台,匹配智慧城市、智能家居、能源管理
  • GO-unioffice实现word编辑
  • SpringMVC的拦截器(Interceptor)
  • 【git】gitlab常用命令
  • 解读下SWD协议以及其应用
  • 基于单目的光流法测速
  • 排序-算法
  • 【特纳斯电子】基于单片机的火灾监测报警系统-实物设计
  • 网络安全就业形势怎么样?
  • 【Golang】Go的并发和并行性解释。谁说Go不是并行语言?
  • k8s-16 k8s调度
  • 【2023研电赛】全国技术竞赛一等奖:基于FPGA的超低时延激光多媒体终端
  • Annoy vs Milvus:哪个向量数据库更适合您的AI应用?知其然知其所以然
  • android 13.0 SystemUI导航栏添加虚拟按键功能(一)
  • 内存管理-分页、虚拟地址、虚拟内容、页面置换算法
  • 【C++入门】命名空间详解(从零开始,冲击蓝桥杯)
  • 通过代码MyBatis-plus实现对表中createTime和updateTime进行自动更新