@EnableAsync
@Configuration
public class AsyncConfig
extends org.springframework.scheduling.annotation.AsyncConfigurerSupport
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_EXECUTOR_NAME |
| 构造器和说明 |
|---|
AsyncConfig() |
| 限定符和类型 | 方法和说明 |
|---|---|
Executor |
executorService() |
Executor |
getAsyncExecutor()
自定义 @Async 注解使用系统线程池
|
org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler |
getAsyncUncaughtExceptionHandler()
异步执行异常处理
|
void |
printException(Runnable r,
Throwable t)
打印线程异常信息
|
ScheduledExecutorService |
scheduledExecutorService()
执行周期性或定时任务
|
@Bean(name="futureExecutorService") public Executor executorService()
@Bean(name="scheduledExecutorService") public ScheduledExecutorService scheduledExecutorService()
public Executor getAsyncExecutor()
getAsyncExecutor 在接口中 org.springframework.scheduling.annotation.AsyncConfigurergetAsyncExecutor 在类中 org.springframework.scheduling.annotation.AsyncConfigurerSupportpublic org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler()
getAsyncUncaughtExceptionHandler 在接口中 org.springframework.scheduling.annotation.AsyncConfigurergetAsyncUncaughtExceptionHandler 在类中 org.springframework.scheduling.annotation.AsyncConfigurerSupportCopyright © 2022. All rights reserved.