From 1f29c17677b96325429fa081f307fcad6156e398 Mon Sep 17 00:00:00 2001 From: Bengbengbalabalabeng Date: Thu, 21 May 2026 16:13:14 +0800 Subject: [PATCH] fix(spring): correcting the description of the instantiation and property population phases in the Spring Beans lifecycle --- .../spring/spring-knowledge-and-questions-summary.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/system-design/framework/spring/spring-knowledge-and-questions-summary.md b/docs/system-design/framework/spring/spring-knowledge-and-questions-summary.md index ef65d2b9de5..6fdb343175a 100644 --- a/docs/system-design/framework/spring/spring-knowledge-and-questions-summary.md +++ b/docs/system-design/framework/spring/spring-knowledge-and-questions-summary.md @@ -486,8 +486,8 @@ public class UserThreadLocal { ### ⭐️Bean 的生命周期了解么? -1. **创建 Bean 的实例**:Bean 容器首先会找到配置文件中的 Bean 定义,然后使用 Java 反射 API 来创建 Bean 的实例。 -2. **Bean 属性赋值/填充**:为 Bean 设置相关属性和依赖,例如`@Autowired` 等注解注入的对象、`@Value` 注入的值、`setter`方法或构造函数注入依赖和值、`@Resource`注入的各种资源。 +1. **创建 Bean 的实例**:Bean 容器首先会找到配置文件中的 Bean 定义,然后选用适当的实例化策略(工厂方法、构造函数自动装配或者简单实例化)通过 Java 反射 API 来创建 Bean 的实例。 +2. **Bean 属性赋值/填充**:为 Bean 设置相关属性和依赖,例如处理标记在字段或 Setter 方法上的 `@Autowired`、`@Value`、`@Resource` 等注解。 3. **Bean 初始化**: - 如果 Bean 实现了 `BeanNameAware` 接口,调用 `setBeanName()`方法,传入 Bean 的名字。 - 如果 Bean 实现了 `BeanClassLoaderAware` 接口,调用 `setBeanClassLoader()`方法,传入 `ClassLoader`对象的实例。