Skip to content

Commit 1f29c17

Browse files
fix(spring): correcting the description of the instantiation and property population phases in the Spring Beans lifecycle
1 parent 4a4378d commit 1f29c17

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
@@ -486,8 +486,8 @@ public class UserThreadLocal {
486486

487487
### ⭐️Bean 的生命周期了解么?
488488

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

0 commit comments

Comments
 (0)