我们不生产代码,我们只是代码的搬运工。。。
在springboot中,只需如下两步实现多线程:
1.自定义线程池的配置类,并在类上添加@EnableAsync 注解,
package com.gxcards.common.executor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java