方式一:重写spring默认线程池的方式
1、相关参数配置
#线程相关配置
#核心线程数
task.pool.corePoolSize: 5
#线程池最大线程数
task.pool.maxPoolSize: 20
#线程最大空闲时间
task.pool.keepAliveSeconds: 300
#队列最大容量
task.pool.queueCapacity: 50
#线程名称前缀
task.pool.threadPrefix: pcv-excutor-
2、重写Spring线程池 配置注入
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPo