File tree 2 files changed +9
-1
lines changed
system-design/framework/spring
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -414,6 +414,7 @@ export default sidebar({
414
414
"spring-transaction" ,
415
415
"spring-design-patterns-summary" ,
416
416
"spring-boot-auto-assembly-principles" ,
417
+ "async" ,
417
418
] ,
418
419
} ,
419
420
] ,
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Async 注解原理分析
3
+ category : 框架
4
+ tag :
5
+ - Spring
6
+ ---
7
+
1
8
# ` @Async ` 原理分析
2
9
3
10
` @Async ` 注解由 Spring 框架提供,被该注解标注的类或方法会在 ** 异步线程** 中执行。这意味着当方法被调用时,调用者将不会等待该方法执行完成,而是可以继续执行后续的代码。
4
11
5
- ** 原理概述 :** ` @Async ` 可以异步执行任务,本质上是使用 ** 动态代理** 来实现的。通过 Spring 中的后置处理器 ` BeanPostProcessor ` 为使用 ` @Async ` 注解的类创建动态代理,之后 ` @Async ` 注解方法的调用会被动态代理拦截,在拦截器中将方法的执行封装为异步任务提交给线程池处理。
12
+ ** 原理介绍 :** ` @Async ` 可以异步执行任务,本质上是使用 ** 动态代理** 来实现的。通过 Spring 中的后置处理器 ` BeanPostProcessor ` 为使用 ` @Async ` 注解的类创建动态代理,之后 ` @Async ` 注解方法的调用会被动态代理拦截,在拦截器中将方法的执行封装为异步任务提交给线程池处理。
6
13
7
14
开始讲解 ` @Async ` 的原理之前,我们先来看看` @Async ` 使用。
8
15
You can’t perform that action at this time.
0 commit comments