From f0c58c0660c884a31d5a0a78f455493078a5d9ec Mon Sep 17 00:00:00 2001 From: Wonder Date: Tue, 30 Sep 2025 18:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=20=F0=9F=94=84Update:=20Spring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Spring/1. IoC & AOP.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Spring/1. IoC & AOP.md diff --git a/Spring/1. IoC & AOP.md b/Spring/1. IoC & AOP.md new file mode 100644 index 0000000..8e3d87a --- /dev/null +++ b/Spring/1. IoC & AOP.md @@ -0,0 +1,35 @@ +# IoC & AOP + +**IoC** + +> IoC(Inversion of Control, 控制反转)。是一种思想,核心在于将控制对象的权利从程序员手上移交给容器。能够降低对象之间的耦合度,能够使得资源容易管理。 + +*DI(Dependency Injection)* 是`Spring`实现`IoC`的主要方式 + + +**AOP** + +> AOP(Aspect Oriented Programming, 面向切面编程)。核心在于将横切关注点从核心业务逻辑中分离出来,形成一个个的切面。 + +- 术语 + - 横切关注点 + - 公共行为:日志记录、事务管理、权限控制、接口限流 + - 切面 + - 类:对横切关注点进行封装的类 + - 连接点 + - 方法调用或者方法执行的某个时刻 + - 通知 + - 需要执行的操作 + - `Before` + - `After` + - `AfterReturning` + - `AfterThrowing` + - `Around` + - 切点 + - 表达式:用于匹配连接点 + - `execution(* com.example.service..*(..))` + - 织入 + - 将切面与目标对象连接起来 + - 时机 + - 编译期 + - 运行期 \ No newline at end of file