mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 18:45:57 +08:00
fix 异步任务线程池使用错误
This commit is contained in:
parent
a5ee33b559
commit
de5525a3ec
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user