String 异步注解 @Async
zhairuihao 2020-08-07
java
源码分析
@Async
@EnableAsync
AsyncConfigurationSelector
ProxyAsyncConfiguration
AsyncAnnotationBeanPostProcessor
1. AbstractBeanFactoryAwareAdvisingPostProcessor
1.1. AbstractAdvisingBeanPostProcessor
1.1.1. protected boolean isEligible(Object bean, String beanName)
确定是否需要代理
AbstractAsyncConfiguration
1.循环依赖问题, 添加@lazy
2.SimpleAsyncTaskExecutor
为每个任务新起一个线程
默认线程数不做限制
不复用线程
需要指定线程池