content: package com.ctg.test.Async;
  
  import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.scheduling.annotation.AsyncConfigurer;
  import org.springframework.scheduling.annotation.EnableAsync;
  import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
  import org.springframework.stereotype.Component;
  
  import java.util.concurrent.Executor;
  
  /**
   * @Description: TODO
   * @Author: yanhonghai
   * @Date: 2018/11/8 18:35
   */
  @Configuration
  @EnableAsync
  @Component
  public class TaskExecutorConfig implements AsyncConfigurer {
      @Override
      public Executor getAsyncExecutor() {
          ThreadPoolTaskExecutor threadPoolTaskExecutor=new ThreadPoolTaskExecutor();
          threadPoolTaskExecutor.setCorePoolSize(10);
          threadPoolTaskExecutor.setMaxPoolSize(15);
          threadPoolTaskExecutor.setQueueCapacity(10);
          threadPoolTaskExecutor.initialize();
          return threadPoolTaskExecutor;
      }
  
      @Override
      public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
          return null;
      }
  }
  