Skip to content

Commit ed5f2b7

Browse files
authored
Merge pull request #2856 from bengbengbalabalabeng/main
fix(spring-bean-lifecycle): correcting the description of the instantiation and property population phases
2 parents c3f3c40 + 1f29c17 commit ed5f2b7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

docs/system-design/framework/spring/spring-knowledge-and-questions-summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,8 @@ public class UserThreadLocal {
484484

485485
### ⭐️Bean 的生命周期了解么?
486486

487-
1. **创建 Bean 的实例**:Bean 容器首先会找到配置文件中的 Bean 定义,然后使用 Java 反射 API 来创建 Bean 的实例。
488-
2. **Bean 属性赋值/填充**:为 Bean 设置相关属性和依赖,例如`@Autowired` 等注解注入的对象`@Value` 注入的值、`setter`方法或构造函数注入依赖和值、`@Resource`注入的各种资源
487+
1. **创建 Bean 的实例**:Bean 容器首先会找到配置文件中的 Bean 定义,然后选用适当的实例化策略(工厂方法、构造函数自动装配或者简单实例化)通过 Java 反射 API 来创建 Bean 的实例。
488+
2. **Bean 属性赋值/填充**:为 Bean 设置相关属性和依赖,例如处理标记在字段或 Setter 方法上的 `@Autowired``@Value``@Resource` 等注解
489489
3. **Bean 初始化**
490490
- 如果 Bean 实现了 `BeanNameAware` 接口,调用 `setBeanName()`方法,传入 Bean 的名字。
491491
- 如果 Bean 实现了 `BeanClassLoaderAware` 接口,调用 `setBeanClassLoader()`方法,传入 `ClassLoader`对象的实例。

0 commit comments

Comments
 (0)