package com.dayou.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * 异步任务线程池
 *
 * @author wucl
 */
@Configuration
@EnableAsync
public class AsycConfig {

    @Autowired
    @Qualifier("mainThreadPool")
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @Bean
    public AsyncTaskExecutor asycTaskExecutor() {
        return threadPoolTaskExecutor;
    }
}
