Pre Merge pull request !302 from dlt116616059/dev

This commit is contained in:
dlt116616059 2023-03-09 09:51:51 +00:00 committed by Gitee
commit df83bda0a1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -8,10 +8,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport; import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
/** /**
* 异步配置 * 异步配置
@ -23,15 +23,15 @@ import java.util.concurrent.ScheduledExecutorService;
public class AsyncConfig extends AsyncConfigurerSupport { public class AsyncConfig extends AsyncConfigurerSupport {
@Autowired @Autowired
@Qualifier("scheduledExecutorService") @Qualifier("threadPoolTaskExecutor")
private ScheduledExecutorService scheduledExecutorService; private ThreadPoolTaskExecutor threadPoolTaskExecutor;
/** /**
* 自定义 @Async 注解使用系统线程池 * 自定义 @Async 注解使用系统线程池
*/ */
@Override @Override
public Executor getAsyncExecutor() { public Executor getAsyncExecutor() {
return scheduledExecutorService; return threadPoolTaskExecutor;
} }
/** /**