package com.ltkj.web.config.timer;
|
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Configuration;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
//@Configuration
|
//@EnableAsync
|
public class AsyncConfig {
|
|
@Bean(name = "asyncExecutor")
|
public ThreadPoolTaskExecutor asyncExecutor() {
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
executor.setCorePoolSize(3);
|
executor.setMaxPoolSize(10);
|
executor.setQueueCapacity(10000);
|
executor.setThreadNamePrefix("async-executor-");
|
executor.initialize();
|
return executor;
|
}
|
}
|